backbone.js - backbone validation how to perform an OR condition based validation -
in backbone based project, have form in 1 of set of input fields mandatory. example, input box phone numbers entered, or uploaded file contains phone numbers.
i trying use thedersen backbone validation http://thedersen.com/projects/backbone-validation/. validation patterns , methods seem oriented on per field basis, , not on combination or.
is there way write validator 1 of fields mandatory?
you define custom "required" validator special case. in function check if @ least 1 option (phone number or file) given.
something this:
validation: { attribute: { required: function(val, attr, computed) { return !(val || app.models.phonefile) } } }
Comments
Post a Comment