[jQuery] jqForm: Need help with basic validation...
The plugin:
<http://www.malsup.com/jquery/form/>
My setup:
Within my form, have a hidden field that has the names of the fields
that I want validated:
<input type="hidden" name="required" value="name,email,recipients">
And this is my "test" beforeSubmit function:
function validate(formData, jqForm, options) {
var x = jqForm[0];
var valid = x.required.value.split(","); // This works.
for(var i=0; i < valid.length; i++) { // This works.
var z = valid[i]; // This works.
if (!x.z.value) { alert('no'); } // This fails.
}
return false; // Remove when done testing.
}
What am I doing wrong?
I have tried many variations of the above code, and I think I need
some expert eyeballs to help me problem-solve. :)
Many thanks in advance.
Cheers,
Micky