version 6.0 (Modified)
Request (message{; defaultResponse{; OKButtonTitle{; CancelButtonTitle}}}) String
Parameter | Type | Description | |
message | String | Message to display in the request dialog box | |
defaultResponse | String | Default data for the enterable text area | |
OKButtonTitle | String | OK button title | |
CancelButtonTitle | String | Cancel button title | |
Function result | String | Value entered by user |
Description
The Request command displays a request dialog box composed of a message, a text input area, an OK button, and a Cancel Button.
You pass the message to be displayed in the message parameter. This message can be up to 255 characters long. If the message does not fit into the message area, it can appear truncated, depending on its length and the width of the characters.
By default, the title of the OK button is "OK" and that of the Cancel button is "Cancel." To change the titles of these buttons, pass the new custom titles into the optional parameters OKButtonTitle and CancelButtonTitle. If necessary, the width of the buttons is resized toward the left, according to the width of the custom titles you pass.
The OK button is the default button. If you click the OK button or press Enter to accept the dialog box, the OK system variable is set to 1. If you click the Cancel button to cancel the dialog box, the OK system variable is set to 0.
The user can enter text into the text input area. To specify a default value, pass the default text in the defaultResponse parameter. If the user clicks OK, Request returns the text. If the user clicks Cancel, Request returns an empty string (""). If the response should be a numeric or a date value, convert the string returned by Request to the proper type with the Num or Date functions.
Tip: Do not call the Request command from the section of a form or object method that handles the On Activate or On Deactivate form event; this will cause an endless loop.
Tip: If you need to get several pieces of information from the user, design a form and present it with DIALOG, rather than presenting a succession of Request dialog boxes.
Examples
1. The line:
$vsPrompt:= Request ("Please enter your name:")
will display the request dialog box (on Windows) shown here:
2. The line:
vsPrompt:= Request ("Name of the Employee:";"";"Create Record";"Cancel") If (OK=1) ADD RECORD ([Employees]) ` Note: vsPrompt is then copied into the field [Employees]Last name ` during the On Load event in the form method End if
will display the request dialog box (on Windows) shown here:
3. The line:
$vdPrompt:= Date (Request ("Enter the new date:";String (Current date)))
will display the request dialog box (on Windows) shown here:
See Also