search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

How disable focus in form.

Asked by Santiago Losada Borrajo
1 year ago.

When loading a form, we have a field that is a calendar, when opening the form, it loads the focus on that field and it looks ugly, is there something that can be done to change the focus or disable it?

Answer posted by Dan Letecky [DayPilot]
1 year ago.

You can use "autofocus: false" to disable autofocus or use "focus: 'anotherField'" to autofocus a selected field.

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

const data = {
  start: "2023-11-01T10:00:00",
  end: "2023-11-02T12:00:00",
};

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

See also:
https://api.daypilot.org/daypilot-modal-autofocus/
https://api.daypilot.org/daypilot-modal-focus/

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.