Note: Application logic should not interact with the component's properties or invoke its methods until the BusyContext indicates that the component is ready for interaction.
Attributes
-
(readonly) valid :string
-
The current validity state of the
oj-validation-groupelement.The oj-validation-group's
validproperty value is calculated from all the enabled components it tracks. The most 'invalid' component'svalidproperty value will be oj-validation-group'svalidproperty value. For example, if all the components are valid except one is "invalidShown", then oj-validation-group's valid value will be "invalidShown". If one is "invalidShown" and one is "invalidHidden", then oj-validation-group's valid value will be "invalidShown" since "invalidShown" is more invalid than "invalidHidden".When any of the enabled tracked component's valid value changes, oj-validation-group will be notified and will update its own valid value if it has changed. There is no default value for the valid property since it is a read-only property that is calculated on initialization and kept updated if any of its tracked component's valid value changes.
The oj-validation-group does not filter out components that are hidden. Hidden components will be considered in oj-validation-group's valid calculation as long as they are enabled. A hidden enabled component's valid state is no different than a visible enabled component; if there is an error that isn't a deferred error, its valid value is "invalidShown". You can disable any components you do not want considered in oj-validation-group's valid value.
Note: New valid states may be added to the list of valid values in future releases. If so, we will keep the convention where if it is valid, it will start with "valid". If it is invalid, it will start with "invalid". If it is pending, it will start with "pending".
- Supports writeback:
true
- Since:
- 4.2
Supported Values:
Name Type Description "invalidHidden"string The component has invalid messages hidden and no invalid messages showing. An invalid message is one with severity "error" or higher. "invalidShown"string The component has invalid messages showing. An invalid message is one with severity "error" or higher. "pending"string The component is waiting for the validation state to be determined. The "pending" state is never set in this release of JET. It will be set in a future release. "valid"string The component is valid Names
Item Name Property validProperty change event validChangedProperty change listener attribute (must be of type function) on-valid-changedExample
Get the
validproperty after initialization:// getter var valid = myValidationGroupElement.valid;
Methods
-
focusOn(key) → {void}
-
If the parameter passed in is "@firstInvalidShown", then it sets focus on the first enabled component with invalid messages showing, if any. If nothing is passed in, it will set focus to the first enabled component being tracked, if any. An enabled component is one that is not disabled or readonly.
Parameters:
Name Type Argument Description keystring <optional>
"@firstInvalidShown" will focus on first invalidShown enabled component in DOM order, if any. When no parameter is passed in, the method will focus on first enabled component regardless of the valid state, if any. An enabled component is one that is not disabled or readonly. - Since:
- 4.2.0
Returns:
- Type
- void
Examples
Focus on the first enabled component showing invalid messages.
validationGroupElem.focusOn("@firstInvalidShown");Focus on the first enabled component.
validationGroupElem.focusOn(); -
getProperty(property) → {any}
-
Retrieves a value for a property or a single subproperty for complex properties.
Parameters:
Name Type Description propertystring The property name to get. Supports dot notation for subproperty access. Returns:
- Type
- any
Example
Get a single subproperty of a complex property:
var subpropValue = myComponent.getProperty('complexProperty.subProperty1.subProperty2'); -
setProperties(properties) → {void}
-
Performs a batch set of properties.
Parameters:
Name Type Description propertiesObject An object containing the property and value pairs to set. Returns:
- Type
- void
Example
Set a batch of properties:
myComponent.setProperties({"prop1": "value1", "prop2.subprop": "value2", "prop3": "value3"}); -
setProperty(property, value) → {void}
-
Sets a property or a single subproperty for complex properties and notifies the component of the change, triggering a [property]Changed event.
Parameters:
Name Type Description propertystring The property name to set. Supports dot notation for subproperty access. valueany The new value to set the property to. Returns:
- Type
- void
Example
Set a single subproperty of a complex property:
myComponent.setProperty('complexProperty.subProperty1.subProperty2', "someValue"); -
showMessages() → {void}
-
Takes all deferred messages and shows them on each enabled component. An enabled component is one that is not disabled or readonly. As a result, the valid property may be updated; e.g., if the valid state was "invalidHidden" before showMessages(), the valid state will become "invalidShown" after showMessages().
If there were no deferred messages this method simply returns.
- Since:
- 4.2.0
Returns:
- Type
- void
Example
Display all messages including deferred ones.
validationGroupElem.showMessages();