Dialog.AddField
---------------

Adds a field for the dialog.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Dialog](component_Dialog.md) | [6.4](newinversion64.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |

MBS( "Dialog.AddField"; Label { ; Text; Placeholder; Password; TextViewHeight } ) 

**MBS**( **"Dialog.AddField";** /\* Adds a field for the dialog. \*/  
**$Label**; /\* The label text for the field.e.g. "First Name:" \*/   
**$Text**; /\* Optional; The text for the field.  
This is initial text.e.g. "" \*/   
**$Placeholder**; /\* Optional; The placeholder text shown when no text is in the field.  
(not for text view)e.g. "Put your name here" \*/   
**$Password**; /\* Optional; Pass 1 to hide text with • or 0 for normal text field.e.g. 0 \*/   
**$TextViewHeight**) /\* Optional; Pass number of points in height for a textView.  
If value is &gt;20, we will use a text view instead of a text fiel.de.g. 50 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Label | The label text for the field. | "First Name:" |  |
| Text | The text for the field.   This is initial text. | "" | Optional |
| Placeholder | The placeholder text shown when no text is in the field.   (not for text view) | "Put your name here" | Optional |
| Password | Pass 1 to hide text with • or 0 for normal text field. | 0 | Optional |
| TextViewHeight | Pass number of points in height for a textView.   If value is &gt;20, we will use a text view instead of a text fiel.d | 50 | Optional      Added in version **10.0**. |

### Result

Returns index or error.

### Description

Adds a field for the dialog.  
Please use [Dialog.GetFieldText](DialogGetFieldText.md) later to query text for field.  
Returns the index of the field.  
Maximum we allow 10 fields.  
### Examples

Adds two fields:

 Set Variable \[$r ; Value:MBS ("Dialog.AddField"; "Username:"; ""; "username here")\]  
Set Variable \[$r ; Value:MBS ("Dialog.AddField"; "Password:"; ""; "password here"; 1)\]  
### See also

- [Dialog.GetFieldText](DialogGetFieldText.md)
- [SyntaxColoring.AddContextMenuCommand](SyntaxColoringAddContextMenuCommand.md)

### Release notes

- **Version 16.1**
    - Enabled [Dialog.ClearFields](https://www.mbsplugins.eu/DialogClearFields.shtml), [Dialog.AddField](https://www.mbsplugins.eu/DialogAddField.shtml), [Dialog.GetFieldText](https://www.mbsplugins.eu/DialogGetFieldText.shtml) and [Dialog.SetFieldText](https://www.mbsplugins.eu/DialogSetFieldText.shtml) functions for Windows since we got an alternative dialog with edit fields, which does most of our [dialog](https://www.mbsplugins.eu/component_Dialog.shtml) functions.
- **Version 10.0**
    - Added TextViewHeight parameter for [Dialog.AddField](https://www.mbsplugins.eu/DialogAddField.shtml) function.
- **Version 8.1**
    - Changed [Dialog.AddField](http://www.mbsplugins.eu/DialogAddField.shtml) to accept tab keys to switch between fields.

### Example Databases

- [Window/Dialog](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Window/Dialog.shtml#4ScriptAnchor_)

### Blog Entries

- [Goodies 33: Custom context menu commands for FileMaker ScriptWorkspace](https://www.monkeybreadsoftware.com/filemaker/SyntaxColoring/33-CustomcontextmenucommandsforFileMakerScriptWorkspace.shtml)
- [Dialogs with fields for Windows](https://www.mbsplugins.de/archive/2026-02-25/Dialogs_with_fields_for_Window/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 16.1pr4](https://www.mbsplugins.de/archive/2026-02-20/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Advent calendar - Door 12 - Sending Mails](https://www.mbsplugins.de/archive/2024-12-12/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin Advent calendar: 17 - Dialog](https://www.mbsplugins.de/archive/2023-12-17/MBS_Plugin_Advent_calendar_17_/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 9.6pr3](https://www.mbsplugins.de/archive/2019-12-17/MBS_FileMaker_Plugin_version_9/monkeybreadsoftware_blog_filemaker)
- [Add a search and replace command for FileMaker Script Workspace](https://www.mbsplugins.de/archive/2019-11-14/Add_a_search_and_replace_comma/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 8.1pr5](https://www.mbsplugins.de/archive/2018-02-26/MBS_FileMaker_Plugin_version_8/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 6.4pr8](https://www.mbsplugins.de/archive/2016-09-19/MBS_FileMaker_Plugin_version_6/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 6.4pr7](https://www.mbsplugins.de/archive/2016-09-14/MBS_FileMaker_Plugin_version_6/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 13th September 2016 , last changed 18th February 2026

  
[Debugger.Window](DebuggerWindow.md) - [Dialog.ClearFields](DialogClearFields.md)

[HTML Version](DialogAddField.shtml)