Determines whether the control allows multiple items to be selected from a list.
Returns true
if multiple selection is enabled; otherwise, false
.
var ctrl = ix.api.dom.getControl("<ELEMENT-GUID>");
ctrl.multiple; // returns true or false
Check if the control is required.
Returns true
if the control is required; otherwise, false
.
var ctrl = ix.api.dom.getControl("<ELEMENT-GUID>");
ctrl.required; // returns true or false
Sets the control's required state.
The value to set.
var ctrl = ix.api.dom.getControl("<ELEMENT-GUID>");
ctrl.required = true; // sets the control to required
Checks the validity of the control.
A promise that resolves to a ValidationInfo
object.
const validityResult = await ix.api.dom.getControl("<GUID>").checkValidity();
// example of `validityResult` - field is required, but was not filled
ValidationInfo {
valStatus: false,
valMessage: 'Please make a selection',
valType: 'required'
}
Deselects all entries (equivalent to reset).
Whether to trigger the onchange
event.
var ctrl = ix.api.dom.getControl("<ELEMENT-GUID>");
ctrl.deselectAllEntries();
Deselects given entries.
The entries to deselect.
Whether to trigger the onchange
event.
// Get all entries
var ctrl = ix.api.dom.getControl("<ELEMENT-GUID>");
var entries = ctrl.getEntries();
// Deselect entry one and two in list
ctrl.deselectEntries([entries[0], entries[1]]);
Get the current value of the control.
Display text of the selected option as string.
null
when no option is selected// Control values: { value: "1", displayValue: "Option 1" }
var ctrl = ix.api.dom.getControl("<ELEMENT-GUID>");
ctrl.getDisplayValue();
// Returns:
// "Option 1"
// or
// ["Option 1", "Option 2"]
Get the current value of the control.
Value of the form element as string.
null
when no option is selectedvar ctrl = ix.api.dom.getControl("<ELEMENT-GUID>");
var value = ctrl.getValue();
console.log(value);
Deselects all entries.
Whether to trigger the onchange
event triggerOnchange.
var ctrl = ix.api.dom.getControl("<ELEMENT-GUID>");
// Fires onchange event
ctrl.reset(true);
// Without triggering onchange event
ctrl.reset();
Selects all entries.
Whether to trigger the onchange
event.
var ctrl = ix.api.dom.getControl("<ELEMENT-GUID>");
ctrl.selectAllEntries();
Selects the first entry.
Whether to trigger the onchange
event.
var ctrl = ix.api.dom.getControl("<ELEMENT-GUID>");
ctrl.selectFirstEntry();
Sets the value of the control based on its display value.
Optionally, triggers the change
event based on the settings parameter.
The display value to be set.
Optional
settings: { Optional settings to control the triggering of the change
event.
// Control values: { value: "1", displayValue: "Option 1" }
// Set the display value to "Option 1" and trigger the `change` event
var ctrl = ix.api.dom.getControl("<ELEMENT-GUID>");
ctrl.setDisplayValue('Option 1', {
triggerOnchange: 'always'
});
// Set multiple display values and trigger the `change` event
ctrl.setDisplayValue(['Option 1', 'Option 2'], {
triggerOnchange: 'always'
});
Sets the value of the control based on its record id.
Optionally, triggers the change
event based on the settings parameter.
The unformatted raw value to be set.
Optional
settings: { Optional settings to control the triggering of the change
event.
// Control values: { value: ["1", "2"], displayValue: ["Option 1", "Option 2"] }
var ctrl = ix.api.dom.getControl("<ELEMENT-GUID>");
// Set the value to "1" and trigger the `change` event
ctrl.setValue('1', {
triggerOnchange: 'always'
});
// Set multiple values and trigger the `change` event
ctrl.setValue(['1', '2'], {
triggerOnchange: 'always'
});
Dropdown lists will be used to display entries in list format.
Note
This control operates the same way on both edit and view pages. Refer to this documentation for guidance on its use on view pages as well.