捕获客户端验证失败 [英] Catch Client Side Validation failure

查看:88
本文介绍了捕获客户端验证失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我根据div点击提交了一份表单。我点击它时也会启动一个等待指示器。我试图找出是否有办法检测客户端验证是否失败,以便我可以删除等待指示符/从未在提交尝试后显示它...或者我可以手动调用客户端验证在我尝试提交之前?

I've got a form that I'm submitting based on a div click. I also have it launching a waiting indicator when clicked. I'm trying to find out if there is a way to detect if client side validation failed or not so that I can remove the waiting indicator/never show it after a submit attempt...or can I call the the client side validation manually before I attempt the submit?

推荐答案

你可以尝试

$('div').click(function() {
    if ($('form').valid()) {
       //form is valid

    else{
          //invalid form 
    }
  }
});

这篇关于捕获客户端验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆