码上敲享录 > bootstrap简单例子分享 > bootstrapValidator验证隐藏的input

bootstrapValidator验证隐藏的input

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

bootstrapValidator验证隐藏的input


解决方法:

1.html标签如下

<input type="text" class="form-control"  readonly>

<input type="hidden" id="type" name="type" class="form-control" >


2.赋值时调用change方法

$("#type").val(this.form.type).change();


3.验证配置加 excluded:[":disabled"]和trigger:"change"

$('#form').bootstrapValidator({

         message: '格式不正确',

         feedbackIcons: {

           valid: 'glyphicon glyphicon-ok',

           invalid: 'glyphicon glyphicon-remove',

           validating: 'glyphicon glyphicon-refresh'

         },

         excluded:[":disabled"],

         fields: {

           type: {

             message: '分类不能为空',

             trigger:"change", //关键配置

             validators: {

               notEmpty: {

                 message: '分类不能为空'

               },

               stringLength: {

                 max: 200,

                 message: '不能超过200个字'

               },

             }

           },

         }

       });


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

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交