-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathform_wizard.html
305 lines (251 loc) · 13 KB
/
form_wizard.html
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<link href="css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="css/plugins/steps/jquery.steps.css" rel="stylesheet">
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-lg-5">
<div class="jumbotron">
<h1>Steps</h1>
<p>Smart UI component which allows you to easily create wizard-like interfaces.</p>
<p><a href="http://www.jquery-steps.com/GettingStarted" target="_blank" class="btn btn-primary btn-lg" role="button">Learn more about jQuery Steps</a>
</p>
</div>
</div>
<div class="col-lg-7">
<div class="ibox ">
<div class="ibox-title">
<h5>Basic Wizzard</h5>
<div class="ibox-tools">
<a class="collapse-link">
<i class="fa fa-chevron-up"></i>
</a>
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-wrench"></i>
</a>
<ul class="dropdown-menu dropdown-user">
<li><a href="#" class="dropdown-item">Config option 1</a>
</li>
<li><a href="#" class="dropdown-item">Config option 2</a>
</li>
</ul>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="ibox-content">
<p>
This is basic example of Step
</p>
<div id="wizard">
<h1>First Step</h1>
<div class="step-content">
<div class="text-center m-t-md">
<h2>Hello in Step 1</h2>
<p>
This is the first content.
</p>
</div>
</div>
<h1>Second Step</h1>
<div class="step-content">
<div class="text-center m-t-md">
<h2>This is step 2</h2>
<p>
This content is diferent than the first one.
</p>
</div>
</div>
<h1>Third Step</h1>
<div class="step-content">
<div class="text-center m-t-md">
<h2>This is step 3</h2>
<p>
This is last content.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="ibox">
<div class="ibox-title">
<h5>Wizard with Validation</h5>
<div class="ibox-tools">
<a class="collapse-link">
<i class="fa fa-chevron-up"></i>
</a>
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-wrench"></i>
</a>
<ul class="dropdown-menu dropdown-user">
<li><a href="#" class="dropdown-item">Config option 1</a>
</li>
<li><a href="#" class="dropdown-item">Config option 2</a>
</li>
</ul>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="ibox-content">
<h2>
Validation Wizard Form
</h2>
<p>
This example show how to use Steps with jQuery Validation plugin.
</p>
<form id="form" action="#" class="wizard-big">
<h1>Account</h1>
<fieldset>
<h2>Account Information</h2>
<div class="row">
<div class="col-lg-8">
<div class="form-group">
<label>Username *</label>
<input id="userName" name="userName" type="text" class="form-control required">
</div>
<div class="form-group">
<label>Password *</label>
<input id="password" name="password" type="text" class="form-control required">
</div>
<div class="form-group">
<label>Confirm Password *</label>
<input id="confirm" name="confirm" type="text" class="form-control required">
</div>
</div>
<div class="col-lg-4">
<div class="text-center">
<div style="margin-top: 20px">
<i class="fa fa-sign-in" style="font-size: 180px;color: #e5e5e5 "></i>
</div>
</div>
</div>
</div>
</fieldset>
<h1>Profile</h1>
<fieldset>
<h2>Profile Information</h2>
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label>First name *</label>
<input id="name" name="name" type="text" class="form-control required">
</div>
<div class="form-group">
<label>Last name *</label>
<input id="surname" name="surname" type="text" class="form-control required">
</div>
</div>
<div class="col-lg-6">
<div class="form-group">
<label>Email *</label>
<input id="email" name="email" type="text" class="form-control required email">
</div>
<div class="form-group">
<label>Address *</label>
<input id="address" name="address" type="text" class="form-control">
</div>
</div>
</div>
</fieldset>
<h1>Warning</h1>
<fieldset>
<div class="text-center" style="margin-top: 120px">
<h2>You did it Man :-)</h2>
</div>
</fieldset>
<h1>Finish</h1>
<fieldset>
<h2>Terms and Conditions</h2>
<input id="acceptTerms" name="acceptTerms" type="checkbox" class="required"> <label for="acceptTerms">I agree with the Terms and Conditions.</label>
</fieldset>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Mainly scripts -->
<!-- Custom and plugin javascript -->
<script src="js/common.js"></script>
<!-- Steps -->
<script src="js/plugins/steps/jquery.steps.min.js"></script>
<!-- Jquery Validate -->
<script src="js/plugins/validate/jquery.validate.min.js"></script>
<script>
$(document).ready(function(){
$("#wizard").steps();
$("#form").steps({
bodyTag: "fieldset",
onStepChanging: function (event, currentIndex, newIndex)
{
// Always allow going backward even if the current step contains invalid fields!
if (currentIndex > newIndex)
{
return true;
}
// Forbid suppressing "Warning" step if the user is to young
if (newIndex === 3 && Number($("#age").val()) < 18)
{
return false;
}
var form = $(this);
// Clean up if user went backward before
if (currentIndex < newIndex)
{
// To remove error styles
$(".body:eq(" + newIndex + ") label.error", form).remove();
$(".body:eq(" + newIndex + ") .error", form).removeClass("error");
}
// Disable validation on fields that are disabled or hidden.
form.validate().settings.ignore = ":disabled,:hidden";
// Start validation; Prevent going forward if false
return form.valid();
},
onStepChanged: function (event, currentIndex, priorIndex)
{
// Suppress (skip) "Warning" step if the user is old enough.
if (currentIndex === 2 && Number($("#age").val()) >= 18)
{
$(this).steps("next");
}
// Suppress (skip) "Warning" step if the user is old enough and wants to the previous step.
if (currentIndex === 2 && priorIndex === 3)
{
$(this).steps("previous");
}
},
onFinishing: function (event, currentIndex)
{
var form = $(this);
// Disable validation on fields that are disabled.
// At this point it's recommended to do an overall check (mean ignoring only disabled fields)
form.validate().settings.ignore = ":disabled";
// Start validation; Prevent form submission if false
return form.valid();
},
onFinished: function (event, currentIndex)
{
var form = $(this);
// Submit form input
form.submit();
}
}).validate({
errorPlacement: function (error, element)
{
element.before(error);
},
rules: {
confirm: {
equalTo: "#password"
}
}
});
});
</script>