# SelectionFormField Object

> The SelectionFormField objet represents a combobox or a drop-down list on a form. It can be initially empty and it can have a horizontal extension, when it is empty. Depending on whether it is editable, the SelectionFormField is either a combobox or a drop-down list.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Object
- **Introduced:** 28.0
- **Path:** DS Server > Reference > JavaScript API > SelectionFormField Object
- **1113 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/selectionformfield/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/selectionformfield/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/selectionformfield/llms-full.txt

---

### Description

The SelectionFormField objet represents a combobox or a drop-down list on a form. It can be initially empty and it can have a horizontal extension, when it is empty. Depending on whether it is [editable](https://docs.textcontrol.com/ds-server/reference/javascript/textfield/geteditable-method/llms-full.txt), the SelectionFormField is either a combobox or a drop-down list.

### Syntax

```javascript
SelectionFormField
```

### Examples

The following example demonstrates `SelectionFormField` in a practical document-editing workflow. The SelectionFormField objet represents a combobox or a drop-down list on a form. It can be initially empty and it can have a horizontal extension, when it is empty. Depending on whether it is editable, the SelectionFormField is either a combobox or a drop-down list.

```javascript
function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

function inspectSelectionFormField(selectionFormField) {
    selectionFormField.getEmptyWidth(
        function(result) {
            console.log("get empty width result:", result);
        },
        onTxError
    );
}
```

---

## In This Section

- [Javascript: SelectionFormField.getEmptyWidth Method](https://docs.textcontrol.com/ds-server/reference/javascript/selectionformfield/getemptywidth-method/llms-full.txt): Gets the horizontal extension, in twips, of the selection formfield, when it is empty.
- [Javascript: SelectionFormField.getIsDropDownArrowVisible Method](https://docs.textcontrol.com/ds-server/reference/javascript/selectionformfield/getisdropdownarrowvisible-method/llms-full.txt): Gets a value indicating whether a dropdown arrow is shown so that the user can select an item.
- [Javascript: SelectionFormField.getItems Method](https://docs.textcontrol.com/ds-server/reference/javascript/selectionformfield/getitems-method/llms-full.txt): Gets a list of items for the SelectionFormField. An item must not be an empty string.
- [Javascript: SelectionFormField.getSelectedIndex Method](https://docs.textcontrol.com/ds-server/reference/javascript/selectionformfield/getselectedindex-method/llms-full.txt): Gets the index of the selected item of the SelectionFormField. If the property value is -1, no item is selected and the currently selected item is deselected.
- [Javascript: SelectionFormField.setEmptyWidth Method](https://docs.textcontrol.com/ds-server/reference/javascript/selectionformfield/setemptywidth-method/llms-full.txt): Sets the horizontal extension, in twips, of the selection formfield, when it is empty.
- [Javascript: SelectionFormField.setIsDropDownArrowVisible Method](https://docs.textcontrol.com/ds-server/reference/javascript/selectionformfield/setisdropdownarrowvisible-method/llms-full.txt): Sets a value indicating whether a dropdown arrow is shown so that the user can select an item.
- [Javascript: SelectionFormField.setItems Method](https://docs.textcontrol.com/ds-server/reference/javascript/selectionformfield/setitems-method/llms-full.txt): Sets a list of items for the SelectionFormField. An item must not be an empty string.
- [Javascript: SelectionFormField.setSelectedIndex Method](https://docs.textcontrol.com/ds-server/reference/javascript/selectionformfield/setselectedindex-method/llms-full.txt): Sets the index of the selected item of the SelectionFormField. If the property value is -1, no item is selected and the currently selected item is deselected.

---

## Nearby

- **Previous:** [Javascript: SelectionBounds.start Property](https://docs.textcontrol.com/ds-server/reference/javascript/selectionbounds/start-property/llms-full.txt)
- **Next:** [Javascript: SelectionFormField.getEmptyWidth Method](https://docs.textcontrol.com/ds-server/reference/javascript/selectionformfield/getemptywidth-method/llms-full.txt)
