creates a message box with an input
text | string|object | optional, the prompt text as a string, or the prompt configuration object |
type | string|function | optional, the type of a prompt modal box or the callback function |
callback | function | optional, the callback function (can be used, if the modal box type is defined as a second parameter) |
promise | the Promise object |
// basic initialization
webix.prompt("Prompt message", "prompt-warning", function(result) {
// some code
});
// extended initialization
webix.prompt({
title: "A prompt dialog",
text: "Type something",
ok: "Submit",
cancel: "Cancel",
input: {
required:true,
placeholder:"This field is required",
}
}).then(result => {
// do something
});
The method can be used in 2 ways:
1. In the Basic form, the method may take the following parameters:
webix.prompt("Test prompt", "prompt-error");
2. Extended form - contains an object with several available parameters. Non-specified parameters take default values.
webix.prompt({
title: "Prompt title",
text: "Prompt text",
ok: "Submit",
cancel: "Cancel",
input: {
required:true,
placeholder:"This field is required",
}
});
In the extended form, the method takes one parameter - an object with box parameters. The parameters are:
The full list of possible box parameters is given in the related article.
Since webix.prompt() returns a promise, there is no need in a callback functions. However, you can add a callback if this is necessary. As a parameter, the function receives the prompt result status (true or false).
// basic initialization
webix.prompt("Prompt message", "prompt-warning", result => {
// some code
});
// extended initialization
webix.prompt({
title: "A prompt dialog",
text: "Prompt message",
ok: "Submit",
type: "prompt-warning",
cancel: "Cancel",
callback: function(result) {
// do something
}
});
Back to top