Field component

In this article

Coveo for Salesforce 4.2 (April 2020)

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

Options

title

Specifies the title to display above the input.

<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.

<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.

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

placeholder

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

<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.

<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.

<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.

If addQre, addSome, and addCorrelateUsingIdf are all set to false, useSomeOnAllKeywords on the CaseCreation component component needs to be enabled for this option to be useful.

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

enableAnalytic

Specifies whether to enable analytics on the component.

The default value is true.

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

Methods

searchIsValid

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

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

setValid

Marks the field as valid.

$('#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.

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

getValue

Gets the value of the input.

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

getCaseField

Gets the value of the caseField option.

$('#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.
$('#myField').coveo('setValue', 'valueToSet', 'true')

Usage

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