s = prompt(messageʃ, initial_valueʅʃ, prompt_typeʅ);
The
prompt function displays a dialog box showing the string expression
message and provides a text box for an operator to enter a string value. An optional string expression
initial_value determines the starting value displayed to the operator. Another optional argument,
prompt_type, provides a way to customize the kind of entry permitted. Types include:
- password: The entered characters will be masked with asterisks.
- uppercase: Alphabetical characters will automatically be converted to their uppercase equivalents.
- numeric: Only numeric characters can be entered.
- multiline: The text box will support multiple lines of data entry. Lines are separated by the newline character: '\n'.
The password and multiline options are not compatible so when using one of these options, the other option cannot be used. If an initial_value is specified that contains newline characters, but the multiline option is not used, the newlines are converted to spaces.
The function returns a string value containing the entered value. If the operator canceled without entering a string, the function returns a blank string (even if an initial value was provided).
string survey_password = prompt("Enter your password:", password);
if ROOF_TYPE = 9 then // other (specify)
ROOF_TYPE_OTHER = prompt("Specify the kind of roof on the dwelling unit:", ROOF_TYPE_OTHER, multiline);
endif;