DayPilot.Modal.autofocus

The autoFocus property (boolean) enables or disables automatic focus for forms displayed using DayPilot.Modal.form().

Declaration

DayPilot.Modal.autoFocus

Default Value

true

Notes

By default, the modal dialog focuses the first form field when it opens. You can use the focus property to target a specific field instead.

Example

const form = [
  {name: "Start", id: "start", type: "datetime"},
  {name: "End", id: "end", type: "datetime"},
  {name: "Text", id: "text"},
];

const data = {
  text: "Event 1",
  start: "2025-11-01T10:00:00",
  end: "2025-11-02T12:00:00",
};

const modal = await DayPilot.Modal.form(form, data, {
  autoFocus: false
});

See Also

DayPilot.Modal.form()

DayPilot.Modal.focus

DayPilot.Modal Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript