$(document).ready(function () { $('#setup_wiz').modal({ show: true, backdrop: 'static', keyboard: false }); $(window).keydown(function(event){ if(event.keyCode === 13) { event.preventDefault(); return false; } }); }); $.components.register("wizard", { mode: "default", defaults: { step: ".steps .step, .pearls .pearl", templates: { buttons: function () { var options = this.options; return '
'; } } } }); // Example Wizard Form Container ---- Inprogress --- // ----------------------------- // http://formvalidation.io/api/#is-valid-container (function () { var defaults = $.components.getDefaults("wizard"); var options = $.extend(true, {}, defaults, { onInit: function () { $('#exampleFormContainer').formValidation({ framework: 'bootstrap', fields: { password: { validators: { notEmpty: { message: 'The password is required' } } }, confirmPassword: { validators: { identical: { field: 'password', message: 'The password and its confirm are not the same' } } } } }); }, validator: function () { var fv = $('#exampleFormContainer').data('formValidation'); var $this = $(this); // Validate the container fv.validateContainer($this); var isValidStep = fv.isValidContainer($this); if (isValidStep === false || isValidStep === null) { return false; } return true; }, onFinish: function (e) { $('#setup_wiz').modal('toggle'); }, buttonsAppendTo: '.modal-body' }); var exampleWizardFormContainer = $("#exampleWizardFormContainer"); exampleWizardFormContainer.wizard(options); exampleWizardFormContainer.on('wizard::finish', function (e) { var $this = $(this); if ($this.find(".active").prop("id") === "setup_1") { // create user password var password = $("#setup_password").val(); $.post('/trial_setup/update_password', {password: password}, function (result) { if (result === "true") { } }); } // if($this.find(".active").prop("id") === "setup_2"){ // create domains and emails // var password = $("#setup_password").val(); // $.post('/trial_setup/update_password', {password: password}, function (result) { // // }); // } }); // function validateEmail(email) { // var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^