How to use jQuery Validation plugin with form-level server-side validation?

前端 未结 3 735
小蘑菇
小蘑菇 2021-02-04 09:58

What\'s the best way to trigger errors on elements for server-side validation errors that come back after the form passes the initial client-side validation?

$(\         


        
3条回答
  •  梦谈多话
    2021-02-04 10:01

    I think I figured it out from the documentation of Validator/showErrors

    var validator = $("#contact_form").validate();
    validator.showErrors({"state": "Bad state."});
    

提交回复
热议问题