[英]Why is it necessary to specify the row property of a field when using formValidation.js?
Looking at the FormValidation getting started docs, they use a row: '.col-xs-5'
property in the script of their Complex Form example. 查看FormValidation入门文档,他们在其复杂表单示例的脚本中使用以下row: '.col-xs-5'
属性。 I'm trying to wrap my head around why this is necessary? 我正在努力思考为什么必须这样做吗? Does it have something to do with properly displaying the feedback message
? 是否与正确显示反馈message
?
they use row option to give a size to error message according to input's size. 他们使用行选项根据输入的大小为错误消息提供大小。
for example : 例如 :
<div class="col-xs-8">
<label class="control-label">Movie title</label>
<input type="text" class="form-control" name="title" />
</div>
the size of title input is col-xs-8
and also you have to give a row option with col-xs-8
to validation option to display the error message in correct width which is the size of input ( col-xs-8
). 标题输入的大小为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'
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.