【问题标题】:Why is it necessary to specify the row property of a field when using formValidation.js?为什么在使用formValidation.js时需要指定字段的row属性?
【发布时间】:2015-03-10 14:08:45
【问题描述】:

查看FormValidation 入门文档,他们在Complex Form 示例的脚本中使用了row: '.col-xs-5' 属性。我想弄清楚为什么这是必要的?是否与正确显示反馈message有关?

【问题讨论】:

    标签: javascript jquery forms validation formvalidation-plugin


    【解决方案1】:

    他们使用 row 选项根据输入的大小为错误消息指定大小。

    例如:

    <div class="col-xs-8">
          <label class="control-label">Movie title</label>
          <input type="text" class="form-control" name="title" />
    </div>
    

    标题输入的大小为col-xs-8,并且您必须为验证选项提供带有col-xs-8 的行选项,以以正确的宽度显示错误消息,即输入大小(col-xs-8)。

     title: {
                    row: '.col-xs-8',
                    validators: {
                        notEmpty: {
                            message: 'The title is required'
                        },
                        stringLength: {
                            max: 200,
                            message: 'The title must be less than 200 characters long'
                        }
                    }
                }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-11
      • 1970-01-01
      • 2020-10-17
      • 2020-08-10
      • 2019-08-07
      • 2020-04-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多