You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an array of validation rules are set for an attribute, then when the validation runs on such an attribute, all validation rules/functions get examined even if one of the rules has already failed. Ideally, the validation engine should stop examining other rules once it encounters a rule that fails validation.
This is important in cases where after a set of basic client side validation, we need to do an ajax call to validate the attribute on server-side. In this case, the server call needs to happen if and only if, all the previous basic validators have passed successfully.
If any of them fail, the final ajax call should not be fired.
Example;
validation: {
username: [{
required: true,
msg: "username is required"
}, {
fn: function(value, attribute, model) {
// do ajax call to validate on server
}]
}
In the above case, when validation is fired against the username field, then even if the username is empty or null, the custom function validator (which calls the server api) still runs. If the first validator(required validator in the above case) has failed, the plugin should not execute any more validators and throw up the error message configured for that validator.
The text was updated successfully, but these errors were encountered:
When an array of validation rules are set for an attribute, then when the validation runs on such an attribute, all validation rules/functions get examined even if one of the rules has already failed. Ideally, the validation engine should stop examining other rules once it encounters a rule that fails validation.
This is important in cases where after a set of basic client side validation, we need to do an ajax call to validate the attribute on server-side. In this case, the server call needs to happen if and only if, all the previous basic validators have passed successfully.
If any of them fail, the final ajax call should not be fired.
Example;
validation: {
username: [{
required: true,
msg: "username is required"
}, {
fn: function(value, attribute, model) {
// do ajax call to validate on server
}]
}
In the above case, when validation is fired against the username field, then even if the username is empty or null, the custom function validator (which calls the server api) still runs. If the first validator(required validator in the above case) has failed, the plugin should not execute any more validators and throw up the error message configured for that validator.
The text was updated successfully, but these errors were encountered: