4D v16.3

Request

Home

 
4D v16.3
Request

Request 


 

Request ( message {; defaultResponse {; OKButtonTitle {; CancelButtonTitle}}} ) -> Function result 
Parameter Type   Description
message  String in Message to display in the request dialog box
defaultResponse  String in Default data for the enterable text area
OKButtonTitle  String in OK button title
CancelButtonTitle  String in Cancel button title
Function result  String in Value entered by user

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. If the message does not fit in the display area (usually around 50 characters, but it varies depending on the System and the font used), it can appear truncated.

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.

The line:

 $vsPrompt:=Request("Please enter your name:")

will display the request dialog box (on Windows) shown here:

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:

The line:

 $vdPrompt:=Date(Request("Enter the new date:";String(Current date)))

will display the request dialog box (on Windows) shown here:



See also 

ALERT
CONFIRM

 
PROPERTIES 

Product: 4D
Theme: Messages
Number: 163

The OK variable is changed by the commandThis command can be run in preemptive processes

 
HISTORY 

Modified: 4D v6

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)