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

    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效