Add translations for validators. New translations will be merged with existing translations and overwritten if they already exists.
the map with translation for validators
Add validators to an element.
the element to add validator to
the defintion of validators to be addede.
Optional
isBaseConfigs: booleanis a boolean which indicates if this configuration should always lay as a base configuration even if overlaying code is changing its validators.
As an example there is FEmailTextField which sets its own EmailValidator
in the constructor. Then the app-code can add its own validatorsConfig on
top of that (example: required: { enabled: $someValue } }
). Setting
isBaseConfigs to true preserves the validatorConfig set by
FEmailTextField as the app code changes the required validatorConfig
(which triggers addValidatorsToElement()
again)
Gets a registered validator by its name, i.e., Validator.name.
The name of the validator to retrieve.
The registered validator with the given name.
Check if given element(s) are valid.
When passing multiple elements all of them must be valid. For non-input
elements (fieldsets, divs, etc) it checks whenever all descendants are
valid. Returns true
if array is empty.
Note: this function does not update the validity state (i.e. run validators) but only checks the current state! Use ValidationServiceInterface.validateElement to update state.
Element instance or id.
Optional
root: Element | DocumentElement (or document) to query when looking up elements by id.
Resolves to true
if all given elements (or descendants) are valid. Empty array resolves to true
.
Use ValidationServiceInterface.validateElement instead.
Register a validator. To be used when a customer validator is needed.
Remove element from ValidationService.
Element to remove validators from.
Set or update validation state on element(s).
Can be used to restore state after page reload, or to set all elements in a subform to submitted.
If passed element is a not a validatable element, the state of all validatable children is updated instead.
Element instance or id
The state to be set
ValidityEvent validityMode
Use ValidationServiceInterface.setSubmitted, ValidationServiceInterface.setTouched, ValidationServiceInterface.setError, ValidationServiceInterface.resetState or request a specific function is added if you have another use-case.
Update validation status of given element.
Element instance or id. Element must be attached to document
.
Whether any of the fields are touched