var ctrl = ix.api.dom.getControl("<ELEMENT-GUID>");
console.log(ctrl.required);
Sets the control's required
state
var ctrl = ix.api.dom.getControl("<ELEMENT-GUID>");
ctrl.required = false;
Checks if the value matches the format and is in range of values.
const validityResult = await ix.api.dom.getControl("<GUID>").checkValidity();
// example of `validityResult` - the entered value has wrong format
ValidationInfo {
valStatus: false,
valMessage: 'Entry does not correspond to required format. Format: dd.MM.yyyy',
valType: 'pattern'
}
Get the current value of the control or given value as JavaScript date object.
Optional
value: stringix.api.dom.getControl("<GUID>").getDateObject("22.02.2022");
// Returns a date object:
`Tue Feb 22 2022 00:00:00 GMT+0100 (Central European Standard Time)`
Retrieves the current value of the control.
This method returns the current value of the control as a string. If the control does not have a value, it returns an empty string.
The current value of the control, or an empty string if no value is set.
// Get the control by its element GUID and retrieve the value
const value = ix.api.dom.getControl("<ELEMENT-GUID>").getValue();
console.log(value); // Outputs the value to the console
Set value of the control.
Optional
settings: { Optional
triggerPlease use setValue instead!
Sets a value for the control.
The value must be either a string (in the same format the field is configured with) or an date object.
NOTE: If the value dosen't match the field's format, no value will be set.
Optional
settings: { Optional
triggerConverts a JavaScript date object to a string like 22.02.2022
.
The output depends on the field's format settings.
// convert a given date object
ix.api.dom.getControl("<GUID>").toLocalFormat(new Date(2022, 01, 22));
// returns
'22.02.2022'
Gets the control's
required
state.