(function() { $(\'#adminValidator\').wizard({ onInit: function() { $(\'#validation\').formValidation({ framework: \'bootstrap\', fields: { username: { validators: { notEmpty: { message: \'The username is required\' }, stringLength: { min: 3, max: 30, message: \'The username must be more than 2 and less than 30 characters long\' }, regexp: { regexp: /^[a-zA-Z0-9_\.\@]+$/, message: \'The username can only consist of alphabetical, number, at sign, dot and underscore\' } } }, license: { validators: { regexp: { regexp: /^[a-zA-Z0-9_\.]+$/, message: \'Please choose a license\' } } }, email: { validators: { notEmpty: { message: \'The email address is required\' }, emailAddress: { message: \'The input is not a valid email address\' } } }, hashKey: { validators: { notEmpty: { message: \'The hash key is required\' }, stringLength: { min: 3, max: 30, message: \'The hash key must be more than 2 and less than 30 characters long\' } } }, dbPath: { validators: { notEmpty: { message: \'The database location is required\' } } }, dbName: { validators: { notEmpty: { message: \'The Database Name is required\' }, stringLength: { min: 2, max: 30, message: \'The Database Name must be more than 1 and less than 30 characters long\' }, regexp: { regexp: /^[a-zA-Z0-9_\.]+$/, message: \'The Database Name can only consist of alphabetical, number, dot and underscore\' } } }, api: { validators: { notEmpty: { message: \'The API Key is required\' }, stringLength: { min: 20, max: 20, message: \'The API Key must be 20 characters long\' } } }, registrationPassword: { validators: { notEmpty: { message: \'The registration password is required\' } } }, password: { validators: { notEmpty: { message: \'The password is required\' }, different: { field: \'username\', message: \'The password cannot be the same as username\' } } } } }); }, validator: function() { var fv = $(\'#validation\').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() { var post = $( \'#validation\' ).serializeToJSON(); organizrAPI2(\'POST\',\'api/v2/wizard\',post).success(function(data) { var html = data.response; location.reload(); }).fail(function(xhr) { OrganizrApiError(xhr, \'API Error\'); }); } }); generateAPI(); $( ".wizardInput" ).focusout(function() { var value = $(this).val(); var name = $(this).attr(\'name\'); if (typeof value !== \'undefined\' && typeof name !== \'undefined\') { $(\'#verify-\'+name).text(value); } }); })();