I have a form loaded in multiple twitter-wizard tabs whic i need to validate the current tab before moving to the next with BootstrapValidator
'onNext': function(tab, nav, index) {
var $validator=$('#staffForm').bootstrapValidator(options).bootstrapValidator('validate');
var $valid = $("#staffForm").valid(); <-- this is line 177, the error line
if(!$valid) {
$validator.focusInvalid();
return false;
}
}
I get this error
Uncaught TypeError: undefined is not a function VM7348:177
$.bootstrapWizard.onNext VM7348:177
what am i doing wrong?
After much searching, i found another way to do it
$('#wizard').bootstrapWizard({onNext: function(tab, navigation, index) {
$valid = true;
$newUser = $('#newUser').data('bootstrapValidator'); //the validator
$wizard = $('#wizard').data('bootstrapWizard'); //the wizard
$tab = $('#wizard').find('.tab-content').children().eq($wizard.currentIndex())
$tab.find('input:text, input:password, input:file, select, textarea, input:not([type=hidden])')
.each(function() {
if ($newUser.options.fields[$(this).attr('name')]) {
$newUser.validateField($(this).attr('name'));
if ($(this).closest('.form-group').hasClass('has-error')){
$valid = false;
}
}
});
return $valid ;
}
I hope this would be useful to anyone