Dialogs Plugin

(part of package 'Servoy Default Services')

You can access it in code via: plugins.dialogs

Properties

API

showErrorDialog(dialogTitle,dialogMessage,buttonsText)

Shows an error dialog with the specified title, message and a customizable set of buttons.

Example:

//show dialog
var thePressedButton = plugins.dialogs.showErrorDialog('Title', 'Value not allowed','OK', 'Cancel');

Parameters:

  • {String} dialogTitle Dialog title.

  • {String} dialogMessage Dialog message.

  • {String...} [buttonsText] Variable arguments of button texts..

Returns: String Pressed button or null if closed by escape key


showInfoDialog(dialogTitle,dialogMessage,buttonsText)

Shows an info dialog with the specified title, message and a customizable set of buttons.

Example:

//show dialog
var thePressedButton = plugins.dialogs.showInfoDialog('Title', 'Value not allowed','OK', 'Cancel');

Parameters:

  • {String} dialogTitle Dialog title.

  • {String} [dialogMessage] Dialog message.

  • {String...} [buttonsText] Variable arguments of button texts..

Returns: String The text of the button that was pressed by the user, or null if the dialog was closed without selection.


showInputDialog(dialogTitle,dialogMessage,initialValue,inputType)

Shows an input dialog where the user can enter data. Returns the entered data, or nothing when canceled.

Example:

//show input dialog ,returns nothing when canceled
var typedInput = plugins.dialogs.showInputDialog('Specify','Your name');

Parameters:

  • {String} [dialogTitle] Dialog title.

  • {String} [dialogMessage] Dialog message.

  • {String} [initialValue] The default value pre-filled in the input field when the dialog opens.

  • {String} [inputType] The type of the input field, one of: color, date, datetime-local, email, month, number, password, tel, text, time, url, week

Returns: String The user-entered value if confirmed, or null if the dialog was canceled.


showQuestionDialog(dialogTitle,dialogMessage,buttonsText)

Shows a question dialog with the specified title, message and a customizable set of buttons.

Example:

//show dialog
var thePressedButton = plugins.dialogs.showQuestionDialog('Title', 'Value not allowed','OK', 'Cancel');

Parameters:

  • {String} dialogTitle Dialog title.

  • {String} dialogMessage Dialog message.

  • {String...} [buttonsText] Variable arguments of button texts..

Returns: String The text of the button that was pressed by the user.


showSelectDialog(dialogTitle,dialogMessage,options)

Shows a selection dialog, where the user can select an entry from a list of options. Returns the selected entry, or nothing when canceled.

Example:

//show select,returns nothing when canceled
var selectedValue = plugins.dialogs.showSelectDialog('Select','please select a name','jan','johan','sebastiaan');
//also possible to pass array with options
//var selectedValue = plugins.dialogs.showSelectDialog('Select','please select a name', new Array('jan','johan','sebastiaan'));

Parameters:

  • {String} dialogTitle The title of the selection dialog.

  • {String} dialogMessage The message or prompt displayed in the dialog.

  • {String...} options A list of selectable options, either as individual strings or an array of strings.

Returns: String The selected option from the list, or null if the dialog was canceled.


showWarningDialog(dialogTitle,dialogMessage,buttonsText)

Shows a message dialog with the specified title, message and a customizable set of buttons. Returns pressed button text, in case window is closed without pressing any button return value depends on client type.

Example:

//show dialog
var thePressedButton = plugins.dialogs.showWarningDialog('Title', 'Value not allowed','OK', 'Cancel');

Parameters:

  • {String} dialogTitle Dialog title.

  • {String} dialogMessage Dialog message.

  • {String...} [buttonsText] Variable arguments of button texts.

Returns: String Pressed button text



Last updated

Was this helpful?