# Dialogs Plugin

(part of package '[Servoy Default Services](https://github.com/Servoy/gitbook/blob/master/reference/servoyextensions/packages/services/servoy-default-services.md)')

You can access it in code via: **plugins.dialogs**

## Properties

## API

### showErrorDialog(dialogTitle,dialogMessage,buttonsText)

Shows an error dialog with the specified title, message and a customizable set of buttons.

**Example:**

```js
//show dialog
var thePressedButton = plugins.dialogs.showErrorDialog('Title', 'Value not allowed','OK', 'Cancel');
```

**Parameters:**

> * {[String](/reference/servoycore/dev-api/js-lib/string.md)} dialogTitle Dialog title.
> * {[String](/reference/servoycore/dev-api/js-lib/string.md)} dialogMessage Dialog message.
> * {[String...](/reference/servoycore/dev-api/js-lib/string.md)} \[buttonsText] Variable arguments of button texts..

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) Pressed button or null if closed by escape key

***

### showInfoDialog(dialogTitle,dialogMessage,buttonsText)

Shows an info dialog with the specified title, message and a customizable set of buttons.

**Example:**

```js
//show dialog
var thePressedButton = plugins.dialogs.showInfoDialog('Title', 'Value not allowed','OK', 'Cancel');
```

**Parameters:**

> * {[String](/reference/servoycore/dev-api/js-lib/string.md)} dialogTitle Dialog title.
> * {[String](/reference/servoycore/dev-api/js-lib/string.md)} \[dialogMessage] Dialog message.
> * {[String...](/reference/servoycore/dev-api/js-lib/string.md)} \[buttonsText] Variable arguments of button texts..

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) The text of the button that was pressed by the user, or null if the dialog was closed without selection.

***

### showInputDialog(dialogTitle,dialogMessage,initialValue,inputType)

Shows an input dialog where the user can enter data. Returns the entered data, or nothing when canceled.

**Example:**

```js
//show input dialog ,returns nothing when canceled
var typedInput = plugins.dialogs.showInputDialog('Specify','Your name');
```

**Parameters:**

> * {[String](/reference/servoycore/dev-api/js-lib/string.md)} \[dialogTitle] Dialog title.
> * {[String](/reference/servoycore/dev-api/js-lib/string.md)} \[dialogMessage] Dialog message.
> * {[String](/reference/servoycore/dev-api/js-lib/string.md)} \[initialValue] The default value pre-filled in the input field when the dialog opens.
> * {[String](/reference/servoycore/dev-api/js-lib/string.md)} \[inputType] The type of the input field, one of: color, date, datetime-local, email, month, number, password, tel, text, time, url, week

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) The user-entered value if confirmed, or null if the dialog was canceled.

***

### showQuestionDialog(dialogTitle,dialogMessage,buttonsText)

Shows a question dialog with the specified title, message and a customizable set of buttons.

**Example:**

```js
//show dialog
var thePressedButton = plugins.dialogs.showQuestionDialog('Title', 'Value not allowed','OK', 'Cancel');
```

**Parameters:**

> * {[String](/reference/servoycore/dev-api/js-lib/string.md)} dialogTitle Dialog title.
> * {[String](/reference/servoycore/dev-api/js-lib/string.md)} dialogMessage Dialog message.
> * {[String...](/reference/servoycore/dev-api/js-lib/string.md)} \[buttonsText] Variable arguments of button texts..

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) The text of the button that was pressed by the user.

***

### showSelectDialog(dialogTitle,dialogMessage,options)

Shows a selection dialog, where the user can select an entry from a list of options. Returns the selected entry, or nothing when canceled.

**Example:**

```js
//show select,returns nothing when canceled
var selectedValue = plugins.dialogs.showSelectDialog('Select','please select a name','jan','johan','sebastiaan');
//also possible to pass array with options
//var selectedValue = plugins.dialogs.showSelectDialog('Select','please select a name', new Array('jan','johan','sebastiaan'));
```

**Parameters:**

> * {[String](/reference/servoycore/dev-api/js-lib/string.md)} dialogTitle The title of the selection dialog.
> * {[String](/reference/servoycore/dev-api/js-lib/string.md)} dialogMessage The message or prompt displayed in the dialog.
> * {[String...](/reference/servoycore/dev-api/js-lib/string.md)} options A list of selectable options, either as individual strings or an array of strings.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) The selected option from the list, or null if the dialog was canceled.

***

### showWarningDialog(dialogTitle,dialogMessage,buttonsText)

Shows a message dialog with the specified title, message and a customizable set of buttons.\
Returns pressed button text, in case window is closed without pressing any button return value depends on client type.

**Example:**

```js
//show dialog
var thePressedButton = plugins.dialogs.showWarningDialog('Title', 'Value not allowed','OK', 'Cancel');
```

**Parameters:**

> * {[String](/reference/servoycore/dev-api/js-lib/string.md)} dialogTitle Dialog title.
> * {[String](/reference/servoycore/dev-api/js-lib/string.md)} dialogMessage Dialog message.
> * {[String...](/reference/servoycore/dev-api/js-lib/string.md)} \[buttonsText] Variable arguments of button texts.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) Pressed button text

***

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.servoy.com/reference/servoyextensions/browser-plugins/servoy-dialogs-plugin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
