form-wizard.js
2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
$(document).ready(function() {
var $validator = $("#wizardForm").validate({
rules: {
exampleInputName: {
required: true
},
exampleInputName2: {
required: true
},
exampleInputEmail: {
required: true,
email: true
},
exampleInputPassword1: {
required: true
},
exampleInputPassword2: {
required: true,
equalTo: '#exampleInputPassword1'
},
exampleInputProductName: {
required: true
},
exampleInputProductId: {
required: true
},
exampleInputQuantity: {
required: true
},
exampleInputCard: {
required: true,
number: true
},
exampleInputSecurity: {
required: true,
number: true
},
exampleInputHolder: {
required: true
},
exampleInputExpiration: {
required: true,
date: true
},
exampleInputCsv: {
required: true,
number: true
}
}
});
$('#rootwizard').bootstrapWizard({
'tabClass': 'nav nav-tabs',
onTabShow: function(tab, navigation, index) {
var $total = navigation.find('li').length;
var $current = index+1;
var $percent = ($current/$total) * 100;
$('#rootwizard').find('.progress-bar').css({width:$percent+'%'});
},
'onNext': function(tab, navigation, index) {
var $valid = $("#wizardForm").valid();
if(!$valid) {
$validator.focusInvalid();
return false;
}
},
'onTabClick': function(tab, navigation, index) {
var $valid = $("#wizardForm").valid();
if(!$valid) {
$validator.focusInvalid();
return false;
}
},
});
$('.date-picker').datepicker({
orientation: "top auto",
autoclose: true
});
});