PromptResponse

A response to a `https://developers.google.com/apps-script/reference/base/ui#prompt(String)` dialog displayed in the
user-interface environment for a Google App. The response contains any text the user entered in
the dialog's input field and indicates which button the user clicked to dismiss the dialog.

```javascript
// Display a dialog box with a title, message, input field, and "Yes" and "No"
// buttons. The user can also close the dialog by clicking the close button in
// its title bar.
const ui = DocumentApp.getUi();
const response = ui.prompt(
    'Getting to know you',
    'May I know your name?',
    ui.ButtonSet.YES_NO,
);

// Process the user's response.
if (response.getSelectedButton() === ui.Button.YES) {
  Logger.log('The user\'s name is %s.', response.getResponseText());
} else if (response.getSelectedButton() === ui.Button.NO) {
  Logger.log('The user didn\'t want to provide a name.');
} else {
  Logger.log('The user clicked the close button in the dialog\'s title bar.');
}
```

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/base/prompt-response#getResponseText()` | `String` | Gets the text that the user entered in the dialog's input field. |
| `https://developers.google.com/apps-script/reference/base/prompt-response#getSelectedButton()` | `https://developers.google.com/apps-script/reference/base/button` | Gets the button that the user clicked to dismiss the dialog. |

## Detailed documentation

### `getResponseText()`

Gets the text that the user entered in the dialog's input field. The text is available even if
the user closed the dialog by clicking a button with a negative connotation, like "Cancel" or
the close button in the dialog's title bar. `https://developers.google.com/apps-script/reference/base/prompt-response#getSelectedButton()` can help to determine
whether the user intended the response text to be valid.

#### Return


`String` --- The text that the user entered in the dialog's input field.

*** ** * ** ***

### `getSelectedButton()`

Gets the button that the user clicked to dismiss the dialog. If the user clicked the close
button that is included in every dialog's title bar, this method returns `https://developers.google.com/apps-script/reference/base/button#CLOSE`.

#### Return


`https://developers.google.com/apps-script/reference/base/button` --- The button that the user clicked.