Abstraction for easy managing of validation of some form. This class uses a Vue
instance with configured Vuelidate
state to provide reactivity of form data.
# new Validator ()
Methods
# initializeWithCustomOptions (params: object, customValidationMixinopt: Vue) static
Create a instance for form data validation based on some options defined as Vue mixin.
Default behavior is to check entity schema attributes with allowNull=true
and defaultView=true
.
customValidationMixin
can extend default behavior by it own rules.
# getAttributeCaption (attributeName: string) → string instance
Get caption by attribute name from attributeCaptions
sections. If it
is not defined, default locale i18n(${entity}.${attributeName}
) will be returned
Arguments:
attributeName
: string
# getErrorForAttribute (attributeName: string) → string | null instance
Get error text for some first failed validation rule of the attribute
Arguments:
attributeName
: string
# getIsAttributeRequired (attributeName: string) → boolean instance
Check if the attribute has the required rule in the configured validation
Arguments:
attributeName
: string
# getValidationState () → object instance
Returns the current state of validation. The method is useful when you have dynamic validation
Return:
Vuelidate object
# reset () instance
Reset validation state
# validateForm (paramsopt: object) instance
Validates form data with the Vuelidate help. If validation is failed UBAbortError
will be thrown