You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.2 KiB
76 lines
2.2 KiB
/**
|
|
* Theme: Montran Admin Template
|
|
* Author: Coderthemes
|
|
* Form wizard page
|
|
*/
|
|
|
|
!function($) {
|
|
"use strict";
|
|
|
|
var FormWizard = function() {};
|
|
|
|
FormWizard.prototype.createBasic = function($form_container) {
|
|
$form_container.children("div").steps({
|
|
headerTag: "h3",
|
|
bodyTag: "section",
|
|
transitionEffect: "slideLeft"
|
|
});
|
|
return $form_container;
|
|
},
|
|
//creates form with validation
|
|
FormWizard.prototype.createValidatorForm = function($form_container) {
|
|
$form_container.validate({
|
|
errorPlacement: function errorPlacement(error, element) {
|
|
element.after(error);
|
|
}
|
|
});
|
|
$form_container.children("div").steps({
|
|
headerTag: "h3",
|
|
bodyTag: "section",
|
|
transitionEffect: "slideLeft",
|
|
onStepChanging: function (event, currentIndex, newIndex) {
|
|
$form_container.validate().settings.ignore = ":disabled,:hidden";
|
|
return $form_container.valid();
|
|
},
|
|
onFinishing: function (event, currentIndex) {
|
|
$form_container.validate().settings.ignore = ":disabled";
|
|
return $form_container.valid();
|
|
},
|
|
onFinished: function (event, currentIndex) {
|
|
alert("Submitted!");
|
|
}
|
|
});
|
|
|
|
return $form_container;
|
|
},
|
|
//creates vertical form
|
|
FormWizard.prototype.createVertical = function($form_container) {
|
|
$form_container.steps({
|
|
headerTag: "h3",
|
|
bodyTag: "section",
|
|
transitionEffect: "fade",
|
|
stepsOrientation: "vertical"
|
|
});
|
|
return $form_container;
|
|
},
|
|
FormWizard.prototype.init = function() {
|
|
//initialzing various forms
|
|
|
|
//basic form
|
|
this.createBasic($("#basic-form"));
|
|
|
|
//form with validation
|
|
this.createValidatorForm($("#wizard-validation-form"));
|
|
|
|
//vertical form
|
|
this.createVertical($("#wizard-vertical"));
|
|
},
|
|
//init
|
|
$.FormWizard = new FormWizard, $.FormWizard.Constructor = FormWizard
|
|
}(window.jQuery),
|
|
|
|
//initializing
|
|
function($) {
|
|
"use strict";
|
|
$.FormWizard.init()
|
|
}(window.jQuery); |