jQuery Validation plugin: disable validation for specified submit buttons

后端 未结 12 781
故里飘歌
故里飘歌 2020-11-22 16:14

I have a form with multiple fields that I\'m validating (some with methods added for custom validation) with Jörn Zaeffere\'s excellent jQuery Validation plugin. How do you

12条回答
  •  爱一瞬间的悲伤
    2020-11-22 16:48

    You can use the onsubmit:false option (see documentation) when wiring up validation which will not validate on submission of the form. And then in your asp:button add an OnClientClick= $('#aspnetForm').valid(); to explicitly check if form is valid.

    You could call this the opt-in model, instead of the opt-out described above.

    Note, I am also using jquery validation with ASP.NET WebForms. There are some issues to navigate but once you get through them, the user experience is very good.

提交回复
热议问题