KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have 4 fields where the user should enter values in at least one of them. So I am trying to validate that each of these 4 fields will be required just when all of them are empty otherwise it won't be required. The rule seems to be working for the one field I picked to try first, but the required error remains even after I provide a value. 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" } });
Tags (comma-separated)
Save Edits
Cancel