form.validate({
doNotHideMessage: true,
errorElement: 'span',
errorClass: 'help-block help-block-error',
focusInvalid: false,
excluded: ':disabled',
rules: {
accountingSoftware: {
required: true,
},
currency_list: {
required: true,
minlength: 1
},
reference: {
required: true,
},
reference2: {
required: true,
},
reference3: {
required: true,
},
moreDetails: {
required: true,
},
card_number: {
required: true,
},
attachedToCard: {
required: true,
minlength: 1
},
},
invalidHandler: function (event, validator) {
success.hide();
error.show();
Metronic.scrollTo(error, -200);
},
highlight: function (element) {
$(element)
.closest('.form-group').removeClass('has-success').addClass('has-error');
},
unhighlight: function (element) {
$(element)
.closest('.form-group').removeClass('has-error');
},
submitHandler: function (form) {
success.show();
error.hide();
}
});
var handleTitle = function (tab, navigation, index) {
var total = navigation.find('li').length;
var current = index + 1;
jQuery('li', $('#form_wizard_1')).removeClass("done");
var li_list = navigation.find('li');
for (var i = 0; i < index; i++) {
jQuery(li_list[i]).addClass("done");
}
if (current == 1) {
$('#form_wizard_1').find('.button-previous').hide();
} else {
$('#form_wizard_1').find('.button-previous').show();
}
if (current >= total) {
$('#form_wizard_1').find('.button-next').hide();
$('#form_wizard_1').find('.button-submit').show();
displayConfirm();
} else {
$('#form_wizard_1').find('.button-next').show();
$('#form_wizard_1').find('.button-submit').hide();
}
Metronic.scrollTo($('.page-title'));
}
$('#form_wizard_1').bootstrapWizard({
'nextSelector': '.button-next',
'previousSelector': '.button-previous',
onTabClick: function (tab, navigation, index, clickedIndex) {
return false;
},
onNext: function (tab, navigation, index) {
success.hide();
error.hide();
if (form.valid() == false) {
return false;
}
handleTitle(tab, navigation, index);
},
onPrevious: function (tab, navigation, index) {
success.hide();
error.hide();
handleTitle(tab, navigation, index);
},
onTabShow: function (tab, navigation, index) {
var total = navigation.find('li').length;
var current = index + 1;
var $percent = (current / total) * 100;
$('#form_wizard_1').find('.progress-bar').css({
width: $percent + '%'
});
}
});
$('#form_wizard_1').find('.button-previous').hide();
$('#form_wizard_1 .button-submit').click(function () {
}).hide();