I have 10 inputs for instance. And I want to check if they're empty using one rule but avoiding reiteration like this:
firstInput :{
required: true,
msg: 'Empty!'
},
// ...
tenthInput :{
required: true,
msg: 'Empty!'
}
Is there any method to use one rule for all inputs using Backbone Validation? And each input can have other unique validation rules the same time, e.g.:
firstInput :{
pattern: email,
msg: 'Email!!!'
}
From the Backbone Validation documentation:
You could then adjust your model to have a function: