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

Is it possible to supply a default text value for the "text" daypilot modal form

Asked by Anonymous
1 year ago.

I’d like to supply users a default value in a text field when a modal is displayed. Is it possible to do so?

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

Yes, the form will load the initial values from the source data object using the property mappings (id property of the form items).

The source data object (data in the example below) is optional. When editing an existing item, you will want to use the existing data. When creating a new item, you can use it to pre-fill the default values.

const form = [
  { name: "Text", id: "text" }
];

const data = {
  text: "Default text value"
};

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

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