-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample_form.php
More file actions
182 lines (150 loc) · 5.39 KB
/
sample_form.php
File metadata and controls
182 lines (150 loc) · 5.39 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
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
<script src="bootstrap/js/jquery-1.11.1.min.js"></script>
<link rel="stylesheet" href="../bootstrap-3.3.7-dist/css/bootstrap.min.css" >
<script src="../bootstrap-3.3.7-dist/js/bootstrap.min.js" ></script>
<link href="font-awesome.css" rel="stylesheet">
<style>
ul#stepForm, ul#stepForm li {
margin: 0;
padding: 0;
}
ul#stepForm li {
list-style: none outside none;
}
label{margin-top: 10px;}
.help-inline-error{color:red;}
</style>
<div class="container" style="padding-left: 0px; padding-right: 15px;">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Complete this form in quick 3 steps!</h3>
</div>
<div class="panel-body">
<form name="basicform" id="basicform" method="post" action="yourpage.html">
<div id="sf1" class="frm">
<fieldset>
<legend>Step 1 of 3</legend>
<div class="form-group">
<label class="col-lg-2 control-label" for="uname">Your Name: </label>
<div class="col-lg-6">
<input type="text" placeholder="Your Name" id="uname" name="uname" class="form-control" autocomplete="off">
</div>
</div>
<div class="clearfix" style="height: 10px;clear: both;"></div>
<div class="form-group">
<div class="col-lg-10 col-lg-offset-2">
<button class="btn btn-primary open1" type="button">Next <span class="fa fa-arrow-right"></span></button>
</div>
</div>
</fieldset>
</div>
<div id="sf2" class="frm" style="display: none;">
<fieldset>
<legend>Step 2 of 3</legend>
<div class="form-group">
<label class="col-lg-2 control-label" for="uemail">Your Email: </label>
<div class="col-lg-6">
<input type="text" placeholder="Your Email" id="uemail" name="uemail" class="form-control" autocomplete="off">
</div>
</div>
<div class="clearfix" style="height: 10px;clear: both;"></div>
<div class="clearfix" style="height: 10px;clear: both;"></div>
<div class="form-group">
<div class="col-lg-10 col-lg-offset-2">
<button class="btn btn-warning back2" type="button"><span class="fa fa-arrow-left"></span> Back</button>
<button class="btn btn-primary open2" type="button">Next <span class="fa fa-arrow-right"></span></button>
</div>
</div>
</fieldset>
</div>
<div id="sf3" class="frm" style="display: none;">
<fieldset>
<legend>Step 3 of 3</legend>
<div class="form-group">
<label class="col-lg-2 control-label" for="upass1">Password: </label>
<div class="col-lg-6">
<input type="password" placeholder="Your Password" id="upass1" name="upass1" class="form-control" autocomplete="off">
</div>
</div>
<div class="clearfix" style="height: 10px;clear: both;"></div>
<div class="form-group">
<label class="col-lg-2 control-label" for="upass1">Confirm Password: </label>
<div class="col-lg-6">
<input type="password" placeholder="Confirm Password" id="upass2" name="upass2" class="form-control" autocomplete="off">
</div>
</div>
<div class="clearfix" style="height: 10px;clear: both;"></div>
<div class="form-group">
<div class="col-lg-10 col-lg-offset-2">
<button class="btn btn-warning back3" type="button"><span class="fa fa-arrow-left"></span> Back</button>
<button class="btn btn-primary open3" type="button">Submit </button>
</div>
</div>
</fieldset>
</div>
</form>
</div>
</div>
</div>
<script type="text/javascript" src="jquery.validate.js"></script>
<script type="text/javascript">
jQuery().ready(function() {
// validate form on keyup and submit
var v = jQuery("#basicform").validate({
rules: {
uname: {
required: true,
minlength: 2,
maxlength: 16
},
uemail: {
required: true,
minlength: 2,
email: true,
maxlength: 100,
},
upass1: {
required: true,
minlength: 6,
maxlength: 15,
},
upass2: {
required: true,
minlength: 6,
equalTo: "#upass1",
}
},
errorElement: "span",
errorClass: "help-inline-error",
});
$(".open1").click(function() {
if (v.form()) {
$(".frm").hide("fast");
$("#sf2").show("slow");
}
});
$(".open2").click(function() {
if (v.form()) {
$(".frm").hide("fast");
$("#sf3").show("slow");
}
});
$(".open3").click(function() {
if (v.form()) {
$("#loader").show();
setTimeout(function(){
$("#basicform").html('<h2>Thanks for your time.</h2>');
}, 1000);
return false;
}
});
$(".back2").click(function() {
$(".frm").hide("fast");
$("#sf1").show("slow");
});
$(".back3").click(function() {
$(".frm").hide("fast");
$("#sf2").show("slow");
});
});
</script>
<script src="bootstrap/js/bootstrap.min.js"></script>