DayPilot.Modal.focus

The focus property (string) specifies the id of a form field that should be focused when the modal dialog opens. Applies to forms displayed using DayPilot.Modal.form() method.

The specified form field will be focused only when autofocus is set to true.

Default Value

null

Example

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

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

const options = {
  focus: "text"
}

const modal = await DayPilot.Modal.form(form, data, options);