码上敲享录 > bootstrap简单例子分享 > 在bootstrap的modal模态框中使用bootstrapValidator时不重新验证问题

在bootstrap的modal模态框中使用bootstrapValidator时不重新验证问题

上一章章节目录下一章 2020-03-05已有1275人阅读 评论(0)

在bootstrap的modal模态框中使用bootstrapValidator时不重新验证问题


解决方法:

先定义一个方法,在modal弹框之前调用执行,重新绑定验证即可

bindValidation(){

         if($("#form").data('bootstrapValidator')){

             $("#form").data('bootstrapValidator').destroy();

             $('#form').data('bootstrapValidator', null);

         }

         $('#form').bootstrapValidator({

       message: '格式不正确',

       feedbackIcons: {

         valid: 'glyphicon glyphicon-ok',

         invalid: 'glyphicon glyphicon-remove',

         validating: 'glyphicon glyphicon-refresh'

       },

       fields: {

         organizeUnit: {

           message: '输入有误',

           validators: {

             notEmpty: {

               message: '举办单位不能为空'

             },

             stringLength: {

               max: 200,

               message: '举办单位不能超过200个字'

             },

           }

         },

       }

     });


     },


向大家推荐《Activiti工作流实战教程》:https://xiaozhuanlan.com/activiti
0

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交