Previous Topic: ca_pam_getSelectedOptionValues(_id)Next Topic: ca_pam_selectOptionByIndex(_id, index, isSelect)


ca_pam_selectOption(_id, name, value, isSelect)

Selects or clears an option in a Select field based on the option name and value. You can also use this function to prevent selection of a specific option.

This function can both select and unselect an option. If an option is not selected and you want to select the option programmatically, then isSelect is true. If an option is already selected and you want to unselect the option, then use isSelect is false.

Input Parameters
_id (string)

Specifies the unique identifier of the Select field to set.

name (string)

Specifies the name of the specific Select field option.

value (string)

Defines the value of the specific Select field option. This value is the existing value of the option.

isSelect (boolean)

Specifies whether the field is selected (true) or cleared (false).

Return Value

None.

Example
ca_pam_selectOption('Form.City', 'Regional Hub', 'Sydney', true);

This example sets the City field to the option named Regional Hub.

If multiple options are named Regional Hub, then this function applies the option with the specified value. This distinction is important. You can use ca_pam_getSelectedOptionValues(_id) to identify the specific value for a field option, even when multiple options have the same name. For example, users can continue to use a set of standard forms to direct business to the Regional Hub even if value changes.