使用bootstrap进行Formvalidation [英] Formvalidation with bootstrap

查看:126
本文介绍了使用bootstrap进行Formvalidation的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我正在为我的asp.net应用程序使用bootstrap。

并且使用Formvalidation插件验证控件。



它在任何帖子后都没有工作。如果我删除了我的更新面板它工作正常。

如何让它正常工作还有更新面板。



我尝试了以下代码。





Hi all,

I am using bootstrap for my asp.net application.
And for validating controls am using Formvalidation plugin.

It in not working after any post back.If I removed my update panel it is working fine.
How to makes it work properly with update panel also.

I tried the below code.


<script type="text/javascript">
                    Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(instance_initializeRequest);
                    function instance_initializeRequest(sender, args) {
                        if (!Test()) {
                            args.set_cancel(true);
                        }
                    }
                </script>
















<script type="text/javascript">
        function Test() {
            $(document).ready(function () {
                $('#defaultForm').formValidation({
                    message: 'This value is not valid',
                    icon: {
                        valid: 'glyphicon glyphicon-ok',
                        invalid: 'glyphicon glyphicon-remove',
                        validating: 'glyphicon glyphicon-refresh'
                    },
                    fields: {
                        '<%=txtAresinSqft.UniqueID%>': {
                            validators: {
                                integer: {
                                    message: 'The input is not a valid phone number',
                                    country: 'IN'
                                },
                                notEmpty: {
                                    message: 'The phone number is required and can\'t be empty'
                                },
                            }
                        }

                    }
                });
            });
        }
    </script>













<script type="text/javascript">
       
       Sys.WebForms.PageRequestManager.getInstance().add_endRequest(Test);
   </script>









现在工作正常。但是有一个新问题就像没有事件发生一样。



请帮助。我坚持这个问题3天。





谢谢

Subin ks





Now it is working fine . But one new problem came like no events are firing .

Please help .last 3 days I stucked in this problem.


Thank you
Subin ks

推荐答案

(文件).ready(function( ){
(document).ready(function () {


('#defaultForm')。formValidation({
message:'此值无效',
图标:{
有效: 'glyphicon glyphicon-ok',
无效:'glyphicon glyphicon-remove',
验证:'glyphicon glyphicon-refresh'
},
字段:{
' <% = txtAresinSqft.UniqueID %> ':{
验证人:{
整数:{
message:'输入不是有效的电话号码',
国家/地区:'IN'
},
notEmpty:{
消息:'电话号码是必填项,且不能为空'
},
}
}

}
});
});
}
< / script >
('#defaultForm').formValidation({ message: 'This value is not valid', icon: { valid: 'glyphicon glyphicon-ok', invalid: 'glyphicon glyphicon-remove', validating: 'glyphicon glyphicon-refresh' }, fields: { '<%=txtAresinSqft.UniqueID%>': { validators: { integer: { message: 'The input is not a valid phone number', country: 'IN' }, notEmpty: { message: 'The phone number is required and can\'t be empty' }, } } } }); }); } </script>













<script type="text/javascript">
       
       Sys.WebForms.PageRequestManager.getInstance().add_endRequest(Test);
   </script>









现在工作正常。但是有一个新问题就像没有事件发生一样。



请帮助。我坚持这个问题3天。





谢谢

Subin ks





Now it is working fine . But one new problem came like no events are firing .

Please help .last 3 days I stucked in this problem.


Thank you
Subin ks


这篇关于使用bootstrap进行Formvalidation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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