开发者

JQuery UI Dialog + JQuery Validate + Tabbing

开发者 https://www.devze.com 2022-12-08 00:11 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消