---
title: Field component (Deprecated)
slug: '1114'
canonical_url: https://docs.coveo.com/en/1114/
collection: archived-content
source_format: adoc
---
# Field component (Deprecated)

> **Deprecated**
>
> This feature is still available, but no longer supported as of the April 2020 release of Coveo for Salesforce version [4.2](https://docs.coveo.com/en/3236.md#april-2020-release-v4-2-initial-release).

This component adds a text input to a case creation form.

## Options

### `title`

Specifies the title to display above the input.

```xml
<div data-title='<YOUR_TITLE>'></div>
```

Where you replace `<YOUR_TITLE>` by the title you want for your text input.

### `caseField`

Specifies the field used to save the input value when the user submits the form.

```xml
<div data-case-field='<YOUR_FIELD>'></div>
```

Where you replace `<YOUR_FIELD>` by the name of the field you want to use.

### `numberOfLines`

Specifies the input height in number of lines.
The default value is `1`.

```xml
<div data-number-of-lines='1'></div>
```

### `placeholder`

Specifies a short hint displayed inside the input before the user enters a value.

```html
<div data-placeholder='<YOUR_PLACEHOLDER>'></div>
```

Where you replace `<YOUR_PLACEHOLDER>` by the hint message you want to display in the input.

### `tooltip`

Specifies what to display when the user's mouse is over the `title`.

```xml
<div data-tooltip="<YOUR_TOOLTIP>"></div>
```

Where you replace `<YOUR_TOOLTIP>` by the message you want to display when the user's mouse is over the `title`.

### `isRequired`

Specifies whether the input has to be filled before the form can be submitted.
The default value is `true`.

```xml
<div data-is-required='true'></div>
```

### `enableSearch`

Specifies whether to include the entered keywords in the search for related cases.
The default value is `true`.

> **Important**
>
> If `addQre`, `addSome`, and `addCorrelateUsingIdf` are all set to `false`, `useSomeOnAllKeywords` on the [CaseCreation component](https://docs.coveo.com/en/1071.md) needs to be enabled for this option to be useful.

```xml
<div data-enable-search='true'></div>
```

### `enableAnalytic`

Specifies whether to enable analytics on the component.

The default value is `true`.

```xml
<div data-enable-analytic='true'></div>
```

## Methods

### `searchIsValid`

Returns `true` if search is enabled and the value isn't empty.

```javascript
$('#myField').coveo('searchIsValid')
```

### `setValid`

Marks the field as valid.

```javascript
$('#myField').coveo('setValid')
```

### `setInvalid`

Marks the field as invalid, preventing the user from creating a case using the `submit` button.

The field becomes valid if the field changes, the `cancel` button is clicked, or the `setValid` method is called.

```javascript
$('#myField').coveo('setInvalid')
```

### `getValue`

Gets the value of the input.

```javascript
$('#myField').coveo('getValue')
```

### `getCaseField`

Gets the value of the `caseField` option.

```javascript
$('#myField').coveo('getCaseField')
```

### `setValue`

Sets the value of the input, with the following properties:

* `value`: The value to set.
* `triggerChange`: (Optional) Whether to trigger a query.
The default value is `true`.

```javascript
$('#myField').coveo('setValue', 'valueToSet', 'true')
```

## Usage

```xml
<div class="CoveoField"></div>
```