WMLScript » Dialogs » Dialogs.prompt

Syntax:
Dialogs.prompt(message, defaultinput)
message
The mandatory message parameter is a string or text that requests an input from the user.
defaultinput
The mandatory defaultinput parameter can be either a variable or a string value that will be displayed as the default input. You can use the empty string "" if you do not wish to display a default input.

Displays a message, called a prompt, that requires the user to input a value.

The Dialogs.prompt function displays a text message and a default input value, and requires that the user accept the default input or enter a different value. The displayed message is said to prompt the user for an input.

The input value is returned by this function.

Examples

Code:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.WAPforum.org/DTD/wml_1.1.xml">
<wml>

   <card id="card1">
      <p>
         prompt example
      </p>
      <do type="accept">
         <go href="PromptExample.wmls#displayprompt()" />
      </do>
   </card>

   <card id="card2">
      <p>
         Amount = $amount
      </p>
   </card>

</wml>
Explanation:

Code for PromptExample.wml

Language(s): WML
Code:
extern function displayprompt()
{
   var mydefault = "71";
   var result = Dialogs.prompt("Enter amount", mydefault);
   WMLBrowser.setVar("amount", result);
   WMLBrowser.go("PromptExample.wml#card2");
};
Explanation:

Code for PromptExample.wmls

Language(s): WML

See Also: