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 dialogdefaultValue(string) - initial value of the input boxoptions(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.okTextoptions.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
JavaScript prompt() Replacement [code.daypilot.org]
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot