简体   繁体   English

使用validationEngine bootstrap按钮单击验证

[英]Validate on button click using validationEngine bootstrap

I was doing this . 我在做这个 and i was doing pretty ok with the tutorial i am doing the validation for form like this 我正在使用教程做得很好我正在对这样的表单进行验证

<script>
  jQuery(document).ready(function() {
    jQuery("#formID2").validationEngine('attach', {
      onValidationComplete: function(form, status) {
        alert("The form status is: " + status + ", it will never submit");
      }
    })
  });
</script>

I am wondering how to make the validation using button click.. I want to remove the submit form and i want to put the validation on button click. 我想知道如何使用按钮单击进行验证..我想删除提交表单,我想在点击按钮上进行验证。 Any suggestion is appreciated 任何建议表示赞赏

$("#Button1").click(function () {
            var valid = $("#form1").validationEngine('validate');
            var vars = $("#form1").serialize();

            if (valid == true) {

                alert("Hi");

            } else {
                $("#form1").validationEngine();
            }
        });

Try this one i got it from here it worked for me! 尝试这个我从这里得到它它为我工作!

When Button type is == Submit then use follwing code, 当Button类型为== Submit时,请使用以下代码,

$("#FormId").validationEngine({
        onValidationComplete : function(form, status) {
            if (status) {
                 alert("Hi");                   
            }
            return false;
        },
        scroll : false,
    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM