I am using bootstrap validation but its triggering before I submit the form.
我正在使用bootstrap验证,但在提交表单之前它会触发。
Below is my code that I am calling in my load function .
下面是我在load函数中调用的代码。
<div class="col-sm-4 col-lg-2 NoteType disableAll" id="NoteTypeDiv">
<label class="control-label" for="NoteType">Note Type<span class="required">*</span></label>
<select class="form-control" id="NoteType" name="NoteType" ddlist="" onchange="Clinical_Notes.GetNotesTemplates();">
<option selected="selected" value="">-Select-</option>
</select>
</div>
JS Code:-
JS代码:
ValidateNotes: function (FrmCtrl) {
$('#' + Clinical_Notes.params.PanelID + '#frmClinicalNotes').bootstrapValidator('destroy');
$('#' + FrmCtrl)
.bootstrapValidator({
live: 'disabled',
message: 'This value is not valid',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
NoteType: {
group: '.col-sm-4',
validators: {
notEmpty: {
message: ''
},
}
},
}
How can I solve this issue?
我如何解决这个问题?
1 个解决方案
#1
1
Well, there is an additional attribute trigger
in bootstarp validator you can try that.
在bootstarp验证器中有一个附加的属性触发器,您可以尝试一下。
You can choose the options when you want to trigger the validator.
当您想要触发验证器时,您可以选择这些选项。
$('#update-form').bootstrapValidator({
trigger: 'blur', // change values here
fields: {}
});
Similar sample:- http://jsfiddle.net/vikash2402/x7pooh99/12/
类似的示例:http://jsfiddle.net/vikash2402/x7pooh99/12/
Validation on Submit:- https://github.com/1000hz/bootstrap-validator/issues/240
验证提交:https://github.com/1000hz/bootstrap-validator/issues/240
Hoping this will help you:)
希望这能帮助你:
#1
1
Well, there is an additional attribute trigger
in bootstarp validator you can try that.
在bootstarp验证器中有一个附加的属性触发器,您可以尝试一下。
You can choose the options when you want to trigger the validator.
当您想要触发验证器时,您可以选择这些选项。
$('#update-form').bootstrapValidator({
trigger: 'blur', // change values here
fields: {}
});
Similar sample:- http://jsfiddle.net/vikash2402/x7pooh99/12/
类似的示例:http://jsfiddle.net/vikash2402/x7pooh99/12/
Validation on Submit:- https://github.com/1000hz/bootstrap-validator/issues/240
验证提交:https://github.com/1000hz/bootstrap-validator/issues/240
Hoping this will help you:)
希望这能帮助你: