JQuery UI Dialog + JQuery Validate + Tabbing
I have a jquery ui dialog with a form inside. If I call the validate method of the jquery.validate plugin, tabbing inside the 开发者_开发技巧form fields strangely submits the form.
If I remove the call to validate, the odd behaviour dissapears, but then I would have to validate by hand.
Any ideas why?
Can't post code right now, but could create a simplification and post it if needed.
I am not sure what do you mean by tabbing, but I had the same issue with dialog and form validation. First, it was picky about <input type="submit" id="submit-your-enquiry" value="Send"/>
Then the submit itself, at the end I had to do the validation by myself and to be honest sounded logical for my usage.
$(document).ready(function(){
$('#submit-your-enquiry').click(function(){
if(validate_enquiry_form('#enquiry-form')){
//$('#enquiry-form #submit-your-enquiry').hide();
send_enquiry_form('#enquiry-form');
}
return false; //VERY IMPORTANT
});
});
And my send_enquiry_form was
just a simple ajax
.
Hope it helps.
精彩评论