Input, textarea and select tags has custom attribute validate that will watch changes for this field.
Form tag has onvalidate attribute, that is function, that returns object of fields by name attribute and checks is it valid => true or is it invalid => "String error message".
Form has one more additional attribute error that identifies by string to where validation errors should be sent.
New tag errors that renders errors pushed by forms validation.
Submit button has additional attribute too validate-submit. It checks if submit button should be available or not => disabled.
Added
Usage
validate
that will watch changes for this field.onvalidate
attribute, that is function, that returns object of fields byname
attribute and checks is it valid =>true
or is it invalid =>"String error message"
.error
that identifies by string to where validation errors should be sent.errors
that renders errors pushed by forms validation.validate-submit
. It checks if submit button should be available or not =>disabled
.Usage of
Validator
This radi version introduces new class
Validator
. It takes in value, chains validations/error messages.At the end call
.check()
to validate this chain and it returnstrue
or"Error message"
.After every validation rule we can call
.error(String)
. It will serve as error message if validation rule before this fails.Default validation rules
required()
min(Number)
max(Number)
email()
This will return
"E-mail is invalid"