DayPilot.Modal.autofocus

The autofocus property (boolean) enables/disables the autofocus for a form displayed by the DayPilot.Modal.form() method.

By default, the modal dialog focuses the first item of the form. You can specify a custom field using the focus property.

Default Value

true

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});