DynaPDF.AddValToChoiceField
---------------------------

Adds a value to a choice field.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [DynaPDF](component_DynaPDF.md) | [4.2](newinversion42.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "DynaPDF.AddValToChoiceField"; PDF; Field; ExpValue; Value { ; Selected } ) 

**MBS**( **"DynaPDF.AddValToChoiceField";** /\* Adds a value to a choice field. \*/  
**$PDF**; /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/   
**$Field**; /\* The field index or field name.e.g. "FirstName" \*/   
**$ExpValue**; /\* Export value (can be empty)e.g. "" \*/   
**$Value**; /\* Visible choice value (required).e.g. "Hello" \*/   
**$Selected**) /\* Optional; Whether this value should be selected. 1 to select and 0 to not select.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |  |
| Field | The field index or field name. | "FirstName" |  |
| ExpValue | Export value (can be empty) | "" |  |
| Value | Visible choice value (required). | "Hello" |  |
| Selected | Whether this value should be selected. 1 to select and 0 to not select. | 0 | Optional |

### Result

Returns OK or error.

### Description

Adds a value to a choice field.   
The parameter Field must be a handle of a combo box or list box. The parameter ExpValue defines the export value that will be submitted to a web server if the value is selected in Adobe's Acrobat. The export value can be an empty string and it is possible to use one export value for multiple values.  
  
The parameter Value is the visible text that can be selected inside the combo box or list box. Value must be a unique string inside the combo box or list box values. Value is required; it must not be an empty string.  
  
If the parameter Selected is true the value appears as selected value in Adobe's Acrobat. List boxes support multiple selected values depending on whether the flag ffMultiSelect was set or not (see [DynaPDF.SetFieldFlags](DynaPDFSetFieldFlags.md) and [DynaPDF.CreateListBox](DynaPDFCreateListBox.md) for further information). If the flag ffMultiSelect is not set, a selected value disables all others (default).  
See also [AddValToChoiceField](https://www.monkeybreadsoftware.com/DynaPDF-Manual/AddValToChoiceField.shtml) function in DynaPDF manual.

### See also

- [DynaPDF.CreateComboBox](DynaPDFCreateComboBox.md)
- [DynaPDF.CreateListBox](DynaPDFCreateListBox.md)
- [DynaPDF.New](DynaPDFNew.md)
- [DynaPDF.SetFieldFlags](DynaPDFSetFieldFlags.md)

### Blog Entries

- [MBS Filemaker Plugin, version 4.2pr5](https://www.mbsplugins.de/archive/2014-05-10/MBS_Filemaker_Plugin_version_4/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 9th July 2015

  
[DynaPDF.AddOutputIntentEx](DynaPDFAddOutputIntentEx.md) - [DynaPDF.AllowPageBreak](DynaPDFAllowPageBreak.md)

[HTML Version](DynaPDFAddValToChoiceField.shtml)