Huy Guys,
I am trying to use jQuery validation plugin and specify that one field is required only when 3 other fields are blank (not filled).
the thing is that the rule is working but it still remain requiring the field even when I type value on it.
Thanks.
This is my code:
$("#ProspectDtlFrm").validate({
rules: {
prsptEmail: {
required: function(element) { return ( $("#prsptHomePhone").val() == '' && $("#prsptBusinessPhone").val() == '' && $("#prsptMobilePhone").val() =='') }
}
},
messages: {
prsptEmail: "Please enter your first name"
}
});
the way is
depends
it's works.The
depends
clause is still supported. This is from 1.11.0pre version:As you can see, yo can choose between "string" and "function". So you can use:
Or
If you only need to test for the existence of something checked.
You could use
depends
:'depends' seems like it's not supported any more, and, their docs are not up to date.
So in the scenario where if a 'yes' tick box is checked, validate another field: