TextPromptDialog
- Since:
Methods
-
async show() → {number}
-
Display the dialog. Every time
show()is called, a new dialog opens, with a unique ID.Returns:
number - The unique ID of the dialog that opens.- Since:
-
withButtons(button0Label, button1Labelopt, button2Labelopt) → {mobicontrol.message.TextPromptDialog}
-
Set the custom buttons for the dialog.
Parameters:
Name Type Attributes Description button0Labelstring The first button's label (cannot be an empty string). button1Labelstring <optional>
The second button's label (cannot be an empty string). button2Labelstring <optional>
The third button's label (cannot be an empty string). Returns:
mobicontrol.message.TextPromptDialog - This dialog.- Since:
Example
mobicontrol.message.createTextPromptDialog('How many balloons do you wish to order?') .withButtons('Red', 'Green', 'Blue') .withCallback(onConfirm).show(); function onConfirm(result) { if (result.buttonLabel != null && isNumeric(result.inputText)) { mobicontrol.log.info('Ordered ' + result.inputText + ' ' + result.buttonLabel + ' balloons.'); } } function isNumeric(num) { return !isNaN(num); } -
withCallback(callbackFunction) → {mobicontrol.message.TextPromptDialog}
-
Set a callback function for the dialog. The callback function is called when the dialog is closed. For example, when the dialog times out, or a button is clicked, or the dialog is dismissed.
Parameters:
Name Type Description callbackFunctionmobicontrol.message.TextPromptDialog.ConfirmationDialogCallback The callback function for this dialog. Returns:
mobicontrol.message.TextPromptDialog - This dialog.- Since:
Example
mobicontrol.message.createTextPromptDialog('What is the account number?') .withCallback(onConfirm).show(); function onConfirm(result) { mobicontrol.log.info(result.inputText); } -
withDefaultText(defaultText) → {mobicontrol.message.TextPromptDialog}
-
Set the default text for the text box.
Parameters:
Name Type Description defaultTextstring The default text to be shown in the text box. Returns:
mobicontrol.message.TextPromptDialog - This dialog.- Since:
Example
mobicontrol.message.createTextPromptDialog('What is the account number?') .withDefaultText("74").show(); -
withErrorIcon() → {mobicontrol.message.TextPromptDialog}
-
Set the error icon for the dialog.
Returns:
mobicontrol.message.TextPromptDialog - This dialog.- Since:
-
withInfoIcon() → {mobicontrol.message.TextPromptDialog}
-
Set the info icon for the dialog.
Returns:
mobicontrol.message.TextPromptDialog - This dialog.- Since:
-
withNotification() → {mobicontrol.message.TextPromptDialog}
-
Set notification for the dialog. Make the dialog create a notification when shown.
Returns:
mobicontrol.message.TextPromptDialog - This dialog.- Since:
-
withQuestionIcon() → {mobicontrol.message.TextPromptDialog}
-
Set the question icon for the dialog.
Returns:
mobicontrol.message.TextPromptDialog - This dialog.- Since:
-
withTimer(timeoutInMillis) → {mobicontrol.message.TextPromptDialog}
-
Set the timeout for the dialog. The dialog is dismissed automatically when the timeout expires.
Parameters:
Name Type Description timeoutInMillisnumber The timeout in milliseconds. Must be greater than zero. Returns:
mobicontrol.message.TextPromptDialog - This dialog.- Since:
-
withTitle(title) → {mobicontrol.message.TextPromptDialog}
-
Set the title for the dialog.
Parameters:
Name Type Description titlestring The title for this dialog. Returns:
mobicontrol.message.TextPromptDialog - This dialog.- Since:
-
withWarnIcon() → {mobicontrol.message.TextPromptDialog}
-
Set the warning icon for the dialog.
Returns:
mobicontrol.message.TextPromptDialog - This dialog.- Since:
Type Definitions
-
ConfirmationDialogCallback(result)
-
Callback function for mobicontrol.message.TextPromptDialog.withCallback.
Parameters:
Name Type Description resultobject Result of the dialog interaction. Properties
Name Type Description inputTextstring The text entered by the user. This property is nullif the dialog was dismissed.isOkButtonboolean trueif the OK button was clicked. This property istrueif the dialog has the standard OK button, and this button was clicked;falseotherwise.
Note: If the dialog has custom buttons set bywithButtons, and the clicked button is labeled 'OK', this property isfalse.buttonIndexnumber The index of the button that was pressed. This property is nullif no button was pressed.isDismissedboolean trueif the dialog was dismissed,falseotherwise. A dialog is considered dismissed if it was closed as a result of event other than a dialog's button click. For example, by expiry of its timer or by a click on the Back button in the navigation bar.isTimedOutboolean trueif the dialog was dismissed due to a timeout,falseotherwise.dialogIdnumber The unique ID of the dialog. buttonLabelstring The label of the clicked button. If the dialog has no custom buttons, this is the English label in all caps. - Since: