This class provides access to Google Apps specific dialog boxes. The methods in this class are only available for use in the context of a Google Spreadsheet.
See also
Properties
Property | Type | Description |
---|---|---|
Buttons | ButtonSet |
Methods
Method | Return type | Brief description |
---|---|---|
inputBox(prompt) | String | Pops up a dialog box with a text input box in the user's browser. |
inputBox(prompt, buttons) | String | Pops up a dialog box with a text input box in the user's browser. |
inputBox(title, prompt, buttons) | String | Pops up a dialog box with a text input box in the user's browser. |
msgBox(prompt) | String | Pops up a dialog box with the given message and an OK button in the user's browser. |
msgBox(prompt, buttons) | String | Pops up a dialog box with the given message and specified buttons in the user's browser. |
msgBox(title, prompt, buttons) | String | Pops up a dialog box with the given title, message and specified buttons in the user's browser. |
Detailed documentation
inputBox(prompt)
Pops up a dialog box with a text input box in the user's browser. The inputBox method raises a client-side input box that displays the given prompt to the user. Note that this function causes the server-side script to be suspended. It will resume automatically after the user clears the dialog, but JDBC connections will not persist across the suspension.
// The code below will set the value of name to the name input by the user, or 'cancel'
var name = Browser.inputBox('Enter your name');
Parameters
Name | Type | Description |
---|---|---|
prompt | String | the text to be displayed in the dialog box |
Return
String
— text entered by the user (or 'cancel' for a canceled or dismissed dialog)
inputBox(prompt, buttons)
Pops up a dialog box with a text input box in the user's browser. The inputBox method raises a client-side input box that displays the given prompt to the user, and offers a choice of buttons to be displayed. Note that this function causes the server-side script to be suspended. It will resume automatically after the user clears the dialog, but JDBC connections will not persist across the suspension.
// The code below will set the value of name to the name input by the user, or 'cancel'
var name = Browser.inputBox('Enter your name', Browser.Buttons.OK_CANCEL);
Parameters
Name | Type | Description |
---|---|---|
prompt | String | the text to be displayed in the dialog box |
buttons | ButtonSet | an enum from Browser.Buttons |
Return
String
— text entered by the user (or 'cancel' for a canceled or dismissed dialog)
inputBox(title, prompt, buttons)
Pops up a dialog box with a text input box in the user's browser. The inputBox method raises a client side input box with the given title, that displays the given prompt to the user, and offers a choice of buttons to be displayed. Note that this function causes the server-side script to be suspended. It will resume automatically after the user clears the dialog, but JDBC connections will not persist across the suspension.
// The code below will set the value of name to the name input by the user, or 'cancel'
var name = Browser.inputBox('ID Check', 'Enter your name', Browser.Buttons.OK_CANCEL);
Parameters
Name | Type | Description |
---|---|---|
title | String | the title for the dialog box |
prompt | String | the text to be displayed in the dialog box |
buttons | ButtonSet | an enum from Browser.Buttons |
Return
String
— text entered by the user (or 'cancel' for a canceled or dismissed dialog)
msgBox(prompt)
Pops up a dialog box with the given message and an OK button in the user's browser. The msgBox method raises a client-side message box that displays the given message to the user. Note that this method causes the server-side script to be suspended. It will resume automatically after the user clears the dialog, but JDBC connections will not persist across the suspension.
// The code below will display "hello world" in a dialog box with an OK button
Browser.msgBox('hello world');
Parameters
Name | Type | Description |
---|---|---|
prompt | String | the text to be displayed in the dialog box |
Return
String
— lower case text of the button that is clicked by the user
msgBox(prompt, buttons)
Pops up a dialog box with the given message and specified buttons in the user's browser. The msgBox method raises a client-side message box that displays the given message to the user, and offers a choice of buttons to be displayed. Note that this method causes the server-side script to be suspended. It will resume automatically after the user clears the dialog, but JDBC connections will not persist across the suspension.
// The code below will display "hello world" in a dialog box with OK and Cancel buttons
Browser.msgBox('hello world', Browser.Buttons.OK_CANCEL);
Parameters
Name | Type | Description |
---|---|---|
prompt | String | the text to be displayed in the dialog box |
buttons | ButtonSet | an enum from Browser.Buttons |
Return
String
— lower case text of the button that is clicked by the user
msgBox(title, prompt, buttons)
Pops up a dialog box with the given title, message and specified buttons in the user's browser. The msgBox method raises a client-side message box with the given title, that displays the given message to the user, and offers a choice of buttons to be displayed. Note that this method causes the server-side script to be suspended. It will resume automatically after the user clears the dialog, but JDBC connections will not persist across the suspension.
// The code below will display "hello world" in a dialog box with a custom title and Yes and
// No buttons
Browser.msgBox('Greetings', 'hello world', Browser.Buttons.YES_NO);
Parameters
Name | Type | Description |
---|---|---|
title | String | the title of the dialog box |
prompt | String | the text to be displayed in the dialog box |
buttons | ButtonSet | an enum from Browser.Buttons |
Return
String
— lower case text of the button that is clicked by the user