I received some great help here the other day and hope once again I can get the answer I need as Im pretty stuck right now. I have a form that has a text input (#USA_sub) and two subsequent text input's (#FirstName) and (#LastName) I have a validation rule that checks to see if each value of (#FirstName) and (#LastName) each appear in (#USA_sub). What I have is working except for this: when you enter the correct value in the (#FirstName) input, correct in that it is contained in (#USA_sub) you only have to enter 2 letters in last name for it to validate. If you skip First Name it requires all of the last name as it should.
$.validator.addMethod(
"firstSig",
function(value, element, params) {
return $(params).val().indexOf(value + ' ' + $("#LastName").val()) > -1;
},
"Your first name must be contained in your Electronic Signature."
);
$.validator.addMethod(
"lastSig",
function(value, element, params) {
return $(params).val().indexOf($("#FirstName").val() + ' ' + value) > -1;
},
"Your last name must be contained in your Electronic Signature."
);
and the validation rules:
FirstName: {
required: true,
minlength: 2,
firstSig: "#USA_sub"
},
LastName: {
required: true,
minlength: 2,
lastSig: "#USA_sub"
}
Thank you!