如何停止 bootstrapValidator 来验证隐藏的输入字段?
How to stop bootstrapValidator to validate hidden input fields?
我想在我的表单中实现 bootstrapValidator,我也有一些隐藏的输入字段,但它也在验证那些,我想停止这个...
我的表单代码
<form id="create_contract_group" method="post"
- List item
>
<div class="row">
<div class="form-group">
<label class="col-md-4 control-label"><b>{!!Lang::get('site_lang.contract_group')!!}</b></label>
<div class="col-md-8">
<input type="text" class="form-control" name="title" placeholder=" Title of the contract group"/>
<input type="text" class="form-control" name="id" style="display:none">
</div>
</div>
</div>
</form>
我的脚本
<script>
$(document).ready(function() {
$('#create_contract_group').bootstrapValidator({
excluded: ':disabled',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
title: {
validators: {
notEmpty: {
message: 'Title is required.'
},
validatorName: validatorOptions
}
},
}
});
});
</script>
您可以在 bootstrap Validator 中使用排除设置,如下所示:
$('#create_contract_group').bootstrapValidator({
excluded: [':disabled', ':hidden', ':not(:visible)'],
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
title: {
validators: {
notEmpty: {
message: 'Title is required.'
},
validatorName: validatorOptions
}
},
}
});
我想在我的表单中实现 bootstrapValidator,我也有一些隐藏的输入字段,但它也在验证那些,我想停止这个... 我的表单代码
<form id="create_contract_group" method="post"
- List item
>
<div class="row">
<div class="form-group">
<label class="col-md-4 control-label"><b>{!!Lang::get('site_lang.contract_group')!!}</b></label>
<div class="col-md-8">
<input type="text" class="form-control" name="title" placeholder=" Title of the contract group"/>
<input type="text" class="form-control" name="id" style="display:none">
</div>
</div>
</div>
</form>
我的脚本
<script>
$(document).ready(function() {
$('#create_contract_group').bootstrapValidator({
excluded: ':disabled',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
title: {
validators: {
notEmpty: {
message: 'Title is required.'
},
validatorName: validatorOptions
}
},
}
});
});
</script>
您可以在 bootstrap Validator 中使用排除设置,如下所示:
$('#create_contract_group').bootstrapValidator({
excluded: [':disabled', ':hidden', ':not(:visible)'],
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
title: {
validators: {
notEmpty: {
message: 'Title is required.'
},
validatorName: validatorOptions
}
},
}
});