我正在尝试向 bootstrap-select 添加验证,但不知何故验证不起作用
首先,我从其他引导程序选择中选择主要类别,然后
按预期使用 ajax 加载子类别...
<select name="code" class="form-control" id="code">
</select>
JS
<script type="text/javascript">
$('#code').on('change', function(e) {
// Revalidate the date field
$('#createSubCode').formValidation('revalidateField', 'code');
});
</script>
更多的
<script type="text/javascript">
$(document).ready(function() {
$('#createSubCode')
.formValidation({
framework: 'bootstrap',
icon: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
title: {
validators: {
notEmpty: {
message: 'The title is required'
}
}
},
code: {
validators: {
notEmpty: {
message: 'The code is required'
}
}
}
}
})
});
</script>
所以每当我选择说代码是必需的!验证不通过!