Hi I am trying to do form validation and I would like to use something similar to this:
http://jquery.bassistance.de/validate/demo/errorcontainer-demo.html
Except How can I get it to only display an error message if either the phone field or address field isn’t provided? Unlike the example I want to just display an error message for phone/address only if one of them isn’t filled in
Hi I am trying to do form validation and I would like to use
Share
Take a look at the options for “required”. You can specify a dependency expression or a dependency callback. This means you are providing a bit of javascript code (within the class attribute, where the example just says
required:true), and you’re saying “if my bit of code evaluates as true, then this form element is required”.So in your case, both the address and the phone fields would need dependency expressions that say “if the other one is empty, this one is required”.