Reputation: 45737
Hello I am using this function from jQuery validate plugin:
$(document).ready(function(){
$('#field1').change( function() {
$('#field1Hidden').val($(this).val());
});
$('#field2').change( function() {
$('#field2Hidden').val($(this).val());
});
$(\"#submForm\").validate({
rules: {
field1Hidden: {
required: false,
accept: \"wav|mp2|mp3|mp4|m4a|wma|vox|aup\"
},
field2Hidden: {
required: false,
accept: \"txt|doc|docx|pdf|odt|rtf\"
}
}
});
});
It works fine. It validates any value as supposed.
But then when all the values are OK the form remains stuck, it will not be submitted.
What is wrong?
Maybe I have to add this somewhere in the code?
form.submit();
If yes where?
I do not know anything about jQuery, I am only a php programmer =D
Thank you
Upvotes: 2
Views: 3711
Reputation: 6446
can you just try this
$(\"#submForm\").validate({
submitHandler: function (form) {
// do the things after validations are ok
},
rules: {
field1Hidden: {
required: false,
accept: \"wav|mp2|mp3|mp4|m4a|wma|vox|aup\"
},
field2Hidden: {
required: false,
accept: \"txt|doc|docx|pdf|odt|rtf\"
}
}
});
Add this before rules section
Upvotes: 2
Reputation: 2049
I believe it might be because you have slashes before the quotes around the #submForm
selector, and the other strings below it.
Ad@m
Upvotes: 0