InputBox: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
(Add javascript snippet)
 
(2 intermediate revisions by one other user not shown)
Line 7: Line 7:
If the user taps OK or presses the Enter key, InputBox returns the text in the input field or an empty string ("") if the input field is empty; if the user taps Cancel or presses the escape key (Esc), InputBox returns “null”.
If the user taps OK or presses the Enter key, InputBox returns the text in the input field or an empty string ("") if the input field is empty; if the user taps Cancel or presses the escape key (Esc), InputBox returns “null”.


== Example (Basic) ==
== Example ==


<pre>
<tabber>
Dim Return
JavaScript=
Return = InputBox("Message area", "", "Default text")
<syntaxhighlight lang="JavaScript">
Print "You entered:", Return
var txtReturn;
</pre>
txtReturn = NSB.InputBox("Message area", "", "Default text")
 
NSB.Print("You entered: " + txtReturn);
== Example (JavaScript) ==
</syntaxhighlight>
<pre>
|-|
var Return;
BASIC=
Return = prompt("Message area", "Default text");
<syntaxhighlight lang="vb.net">
NSB.Print("You entered: " + Return);
Dim txtReturn
</pre>
txtReturn = InputBox("Message area", "", "Default text")
Print "You entered:", txtReturn
</syntaxhighlight>
</tabber>


== Output ==
== Output ==

Latest revision as of 06:29, 5 March 2022

InputBox(prompt[, title[, default]])

Description

InputBox opens a dialog box to prompt a user to input text or click a button. A string is returned containing the contents of the text field from the dialog box. The required parameter, prompt, is a string expression that is displayed in the body of the dialog box. The optional parameter, title, is ignored: it is only for backwards compatibility. The optional parameter, default, is a string expression that is displayed in the text field of the dialog box.

If the user taps OK or presses the Enter key, InputBox returns the text in the input field or an empty string ("") if the input field is empty; if the user taps Cancel or presses the escape key (Esc), InputBox returns “null”.

Example

var txtReturn;
txtReturn = NSB.InputBox("Message area", "", "Default text")
NSB.Print("You entered: " + txtReturn);

Dim txtReturn
txtReturn = InputBox("Message area", "", "Default text")
Print "You entered:", txtReturn

Output

You entered:  Default Text

Related Items

Nsb.InputBox