I’m using the jQuery Validation Plugin on my form. On my form I have a ‘Telephone’ field and a ‘Mobile No.’ field.
How would I go about making it so the user has to fill in one of them, but it can be either field?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This looks like what you need to use dependency-callback
What this will allow you to do is:
You can then place a
requiredvalidation rule on the two telephone fields that will only be required based on the return from the function callback; thus you can put a rule on the telephone field to say require this rule only if the mobile field is blank, and vice versa for the mobile field.This is untested but in theory
Be sure to check comments/other answers for possible updated answers.
UPDATE