# Javascript: DateFormField.setEmptyWidth Method

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

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

---

### Description

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

### Syntax

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

### Parameters

| Parameter | Description |
|---|---|
| emptyWidth | Specifies the horizontal extension, in twips, of the date 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 `DateFormField.setEmptyWidth` in a practical document-editing workflow. It sets the horizontal extension, in twips, of the date formfield, when it is empty.

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

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

---

## Nearby

- **Previous:** [Javascript: DateFormField.setDateFormat Method](https://docs.textcontrol.com/ds-server/reference/javascript/dateformfield/setdateformat-method/llms-full.txt)
- **Next:** [DateFormFieldCallback Function](https://docs.textcontrol.com/ds-server/reference/javascript/dateformfieldcallback/llms-full.txt)
