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

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -