weixin_33721344 2017-11-30 05:59 采纳率: 0%
浏览 7

重新绑定JQuery验证

I am developing a web application in which forms are dynamically loaded using AJAX. I use jQuery validation plugin to validate my forms. Every time a form is submitted a new form will be generated on the server side and sent back in which I will replace a div using html() method. My problem is that the validation should be rebind because every form that is generated on the server-side have its own rules for making a field required or not depending on some rules.

My problem is when a new form is loaded, the jQuery validator is still using the previous rule to validate the form not allowing the user to submit the form. Is there any way to reload any jQuery validation rules once the form is replaced with the html method?

  • 写回答

1条回答 默认 最新

  • weixin_33695450 2017-11-30 08:08
    关注

    have you tried using following code

    jQuery.validator.unobtrusive.parse("#yourformid"); 
    

    after loading your form via ajax call ?

    adding reference link for more information

    评论

报告相同问题?