# Javascript: SelectionFormField.setEmptyWidth Method

> Sets the horizontal extension, in twips, of the selection formfield, when it is empty.

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

---

### Description

Sets the horizontal extension, in twips, of the selection formfield, when it is empty.

### Syntax

```javascript
<void> SelectionFormField.setEmptyWidth(<Number> emptyWidth, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| emptyWidth | Specifies the horizontal extension, in twips, of the text formfield, when it is empty. When this parameter is set to 0, a default value is used. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `SelectionFormField.setEmptyWidth` in a practical document-editing workflow. It sets the horizontal extension, in twips, of the selection formfield, when it is empty.

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

function configureEmptyWidth(selectionFormField) {
    selectionFormField.setEmptyWidth(
        1440,
        function() {
            console.log("set empty width completed.");
        },
        onTxError
    );
}
```

---

## Nearby

- **Previous:** [Javascript: SelectionFormField.getSelectedIndex Method](https://docs.textcontrol.com/ds-server/reference/javascript/selectionformfield/getselectedindex-method/llms-full.txt)
- **Next:** [Javascript: SelectionFormField.setIsDropDownArrowVisible Method](https://docs.textcontrol.com/ds-server/reference/javascript/selectionformfield/setisdropdownarrowvisible-method/llms-full.txt)
