Reputation: 1081
I am using bootstrap validation but its triggering before I submit the form.
Below is my code that I am calling in my load function .
<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:-
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?
Upvotes: 1
Views: 325
Reputation: 5443
Well, there is an additional attribute trigger
in bootstarp validator you can try that.
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/
Validation on Submit:- https://github.com/1000hz/bootstrap-validator/issues/240
Hoping this will help you:)
Upvotes: 1