Prompt.prompt()

Overview

Displays a dialog box that prompt the user for input. This function is asynchronous and will return before the response is given. Use the callback parameter to handle results.

Added in version 1.2.109

Format

Prompt.prompt(title, message, defaultValue, format, resultDelegate);

Parameter Description Type Required
title A title to display for the dialog. Can be null or an empty string if no title is desired. String Required
message The message to display in the dialog box. String Required
defaultValue The default value shown in the dialog box. Can be null or an empty string if no default value is desired. String Required
format Specifies the type of prompt. Either “numeric” and “password” are valid values. Types can be combined using a | character e.g. “numeric|password”. Can be null or an empty string if the default format is desired. String Required
resultDelegate A function that takes a single string result parameter that is called when the user responds to the prompt. If the user presses OK then the value returned will be the entered value in the prompt. If the user presses Cancel, then the value will be undefined. Function with a single String parameter Required

Example

Copy
/* Prompt the user to enter a message to be displayed as a toast.
 */
 
Prompt.prompt("Prompt Title","Enter something to show as a toast:", "I like toast!", null, function (message) {
    if(message) {
        View.toast(message, false);
    }
});