DayPilot.Modal.prompt

The prompt() method displays a pre-configured modal dialog with a custom message and an input box for entering user data.

Declaration

DayPilot.Modal.prompt(message: string, defaultValue?: string, options?: ModalPromptConfig): Promise<ModalClosedArgs>

Parameters

  • message (string) - HTML message displayed in the dialog

  • defaultValue (string) - initial value of the input box

  • options (ModalPromptConfig) - custom prompt dialog options and standard DayPilot.Modal properties

Return Value

Returns a Promise that resolves when the modal dialog is closed, using either button or by clicking the background.

The resolved value is the same args object that is passed to the onClosed event handler. The promise rejection handler is never called.

Notes

In addition to the standard DayPilot.Modal properties, you can specify custom button text using the options object:

  • options.okText

  • options.cancelText

By default, the prompt dialog uses height = 40 and useIframe = false.

Example

const modal = await DayPilot.Modal.prompt("Name:", "Default value");
console.log(modal.result);

See Also

DayPilot.Modal.onClosed

DayPilot.Modal Properties

JavaScript prompt() Replacement [code.daypilot.org]

DayPilot.Modal Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript