I am trying to validate a form having two fields
string email
and file type
file (one of the two is mandatory).
I am validating the form with following code,
$("#addOrganizationMembersForm").validate({
rules : {
csv : {
required : "#emails:empty",
extension: "xls|csv"
},
emails : {
required : "#csv:empty"
}
},
messages : {
csv : {
required : 'Upload a csv or xls file',
extension : 'Only csv files are allowed',
},
emails : {
required : 'Enter one or more comma seperated emails',
}
}
});
This code is validating both fields (But for me if one of the two fields has value i.e email or csv file, then form is valid)
Kindly help me, what is wrong with this code