This method generates a dialog box for user input. Corresponds to the InputBox action.
App.InputBox(Prompt, Title, Value)
Newlook Smartclient only.
The dialog box presented to the user displays the Question icon and has OK and Cancel buttons.
Figure 1. Sample Input Box
Prompt - (String, Required)
Specifies the message that will display in the body of the input box.
Title - (String, Required)
Specifies the text that will display in the title bar of the input box. To display a blank title bar specify "".
Value - (String, Required)
The input text. This parameter is used to provide a default value for the input box entry field and, for VB Scripts ONLY, return the value entered by the user.
When used within JScript scripts, the InputBox method cannot be used to return the value that the user enters into the entry capable text field. To return the entered value you will need to use this method in a vb script or via the InputBox action in a macro instead.
HelpFile - (String, Optional)
This parameter has been deprecated.
Context - (String, Optional)
This parameter has been deprecated.
If the OK button is clicked or the user presses ENTER, the InputBox method returns "1" and the Value parameter returns the current text entered in the dialog box. If the user clicks the Cancel button or presses ESC, the method returns "2" and an empty string is assigned to the Value parameter.
If the OK button is clicked, the InputBox method returns the string "1". If the Cancel button is clicked the InputBox method returns the string "2".
The following example retrieves a customer number from the user via the InputBox method (see Figure 1 above), assigns the input value to a newlook variable and notifies the user if the operation was canceled. VB SCRIPTDim InputResponse Dim InputTitle Dim InputPrompt Dim InputText Dim NoNumber
InputTitle = "Information Required" InputPrompt = "Please enter the customer number:" InputText = "XXXXX-XX" NoNumber = "00000-00"
InputResponse = App.InputBox(InputPrompt,InputTitle,InputText) App.SetValue "CustomerNumber", InputText App.SetValue "ButtonPressed", InputResponse
If InputResponse = 2 Then App.MsgBox "You have cancelled the customer number entry operation.", "Alert" App.SetValue "CustomerNumber", NoNumber End if
JSCRIPTThe use of the InputBox method is not recommended for use in JScript scripts due to its limitations in returning the value entered by the user. |
InputBox Action | SetValue method | MsgBox method
© 2004-2021 looksoftware. All rights reserved.