-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
286 lines (271 loc) · 15.5 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Scrupulous.js | Super simple inline form validation using HTML5 attributes.</title>
<meta name="description" content="Scrupulous.js is a simple form validation jQuery plugin that uses HTML5 attributes">
<meta name="viewport" content="width=device-width">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,300' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/scrupulous.css">
</head>
<body>
<a href="https://github.com/you"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
<div class="container">
<h1>Scrupulous.js</h1>
<p>Scrupulous.js is a jQuery plugin that provides simple, client-side, inline form validation. It uses HTML5 attributes to control validation along with some custom validation methods. Oh, and it plays nicely with <a href="http://getbootstrap.com/">Bootstrap</a>. Check out the demo below, <a href="https://github.com/zaneray/scrupulous">then read the documentation here.</a></p>
<div class="col-xs-12 col-sm-8 col-sm-offset-2">
<form class="validate-form" action="#" method="get">
<input type="hidden" name="hidden-input" id="hidden-input" value="just testing hidden">
<fieldset>
<h3>Standard Validation</h3>
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" id="name" name="name" title="Please Enter a Name" required>
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" id="email" name="email" title="Please Enter a Valid Email Address" required>
</div>
<div class="form-group">
<label for="undefined-field">Undefined Title Field</label>
<input type="text" class="form-control" id="undefined-field" name="undefined-field" required>
</div>
<div class="form-group">
<label for="wrapping">Fields with Wrapping text, Fields with Wrapping text, Fields with Wrapping text</label>
<input type="text" class="form-control" id="wrapping" name="wrapping" required title="This error should wrap, this error should wrap, This error should wrap, this error should wrap">
</div>
<div class="form-group">
<label for="disabled">Disabled Field</label>
<input type="text" class="form-control" id="disabled-input" name="disabled-input" disabled="true" required title="This field was disabled">
</div>
<div class="checkbox">
<label><input type="checkbox" id="toggle-disabled" name="toggle-disabled" value="true">Enable this field</label>
</div>
<div class="form-group">
<label for="state">State</label>
<select id="state" name="state" class="form-control" title="Please select a state" required>
<option value="">Choose One</option>
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="DC">District Of Columbia</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="HI">Hawaii</option>
<option value="ID">Idaho</option>
<option value="IL">Illinois</option>
<option value="IN">Indiana</option>
<option value="IA">Iowa</option>
<option value="KS">Kansas</option>
<option value="KY">Kentucky</option>
<option value="LA">Louisiana</option>
<option value="ME">Maine</option>
<option value="MD">Maryland</option>
<option value="MA">Massachusetts</option>
<option value="MI">Michigan</option>
<option value="MN">Minnesota</option>
<option value="MS">Mississippi</option>
<option value="MO">Missouri</option>
<option value="MT">Montana</option>
<option value="NE">Nebraska</option>
<option value="NV">Nevada</option>
<option value="NH">New Hampshire</option>
<option value="NJ">New Jersey</option>
<option value="NM">New Mexico</option>
<option value="NY">New York</option>
<option value="NC">North Carolina</option>
<option value="ND">North Dakota</option>
<option value="OH">Ohio</option>
<option value="OK">Oklahoma</option>
<option value="OR">Oregon</option>
<option value="PA">Pennsylvania</option>
<option value="RI">Rhode Island</option>
<option value="SC">South Carolina</option>
<option value="SD">South Dakota</option>
<option value="TN">Tennessee</option>
<option value="TX">Texas</option>
<option value="UT">Utah</option>
<option value="VT">Vermont</option>
<option value="VA">Virginia</option>
<option value="WA">Washington</option>
<option value="WV">West Virginia</option>
<option value="WI">Wisconsin</option>
<option value="WY">Wyoming</option>
</select>
</div>
<div class="form-group">
<label for="textarea">Textarea</label>
<textarea class="form-control" id="textarea" name="textarea" title="This field is required" required></textarea>
</div>
<button type="submit" class="btn btn-primary btn-lg">Submit</button>
</fieldset>
</form>
<form class="validate-form" action="#" method="get">
<fieldset>
<h3>Number Input Validation</h3>
<div class="form-group">
<label for="age">Enter Your Age</label>
<input type="number" class="form-control" id="age" name="age" title="Your Age can only be a number" required>
</div>
<div class="form-group">
<label for="age">Enter a Number from 20-30</label>
<input type="number" class="form-control" id="numberminmax" name="numberminmax" min="20" max="30" title="Enter a Valid Number" required>
</div>
<button type="submit" class="btn btn-primary btn-lg">Submit</button>
</fieldset>
</form>
<form class="validate-form" action="#" method="get">
<fieldset>
<h3>Fields that Must Match</h3>
<div class="form-group">
<label for="inputpw">Password</label>
<input type="password" pattern=".{6,}" class="form-control" id="inputpw" title="Passwords are at Least 6 Characters" placeholder="Minimum 6 Characters" required>
</div>
<div class="form-group">
<label for="inputpwrepeat">Repeat Password</label>
<input type="password" pattern=".{6,}" class="form-control" data-equal-to="inputpw" id="inputpwrepeat" title="Passwords Must Match" required>
</div>
<button type="submit" class="btn btn-primary btn-lg">Submit</button>
</fieldset>
</form>
<form class="validate-form" action="#" method="get">
<fieldset>
<h3>Radio Buttons & Checkboxes</h3>
<div class="form-group">
<h4>Select a Checkbox</h4>
<div class="checkbox">
<label><input type="checkbox" value="value1" required="" name="inputcheckbox" title="Please Select an Option 1"> Check me out</label>
</div>
<div class="checkbox">
<label><input type="checkbox" value="value2" required="" name="inputcheckbox" title="Please Select an Option 2"> Check me out</label>
</div>
<div class="checkbox">
<label><input type="checkbox" value="value3" required="" name="inputcheckbox" title="Please Select an Option 3"> Check me out</label>
</div>
</div>
<div class="form-group">
<h4>Select a Radio</h4>
<div class="radio">
<label><input type="radio" value="value1" required="" name="inputradio" title="Please Select an Option 1"> Check me out</label>
</div>
<div class="radio">
<label><input type="radio" value="value2" required="" name="inputradio" title="Please Select an Option 2"> Check me out</label>
</div>
<div class="radio">
<label><input type="radio" value="value3" required="" name="inputradio" title="Please Select an Option 3"> Check me out</label>
</div>
</div>
<button type="submit" class="btn btn-primary btn-lg">Submit</button>
</fieldset>
</form>
</div>
<div class="col-xs-12 center">
<fieldset>
<h3>Inline Forms and Validation</h3>
<form class="form-inline validate-form" role="form">
<div class="form-group">
<input type="number" class="form-control" id="numberinput" placeholder="Enter Number" title="Number is Required" required>
</div>
<div class="form-group">
<input type="email" class="form-control" id="exampleInputEmail2" placeholder="Enter email" title="Email is Required" required>
</div>
<div class="form-group">
<input type="password" class="form-control" id="exampleInputPassword2" placeholder="Password" title="Password is Required" required>
</div>
<button type="submit" class="btn btn-primary">Sign in</button>
</form>
</fieldset>
</div>
<div class="col-xs-12 col-sm-8 col-sm-offset-2">
<form class="callback-form" action="#" method="get">
<fieldset>
<h3>Validation with Callback</h3>
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" id="name" name="name" title="Please Enter a Name" required>
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" id="email" name="email" title="Please Enter a Valid Email Address" required>
</div>
<div class="form-group">
<label for="age">Age</label>
<input type="number" class="form-control" id="age" name="age" title="Your Age can only be a number" required>
</div>
<button type="submit" class="btn btn-primary btn-lg">Submit</button>
</form>
<!-- <form id="custom-message-form" action="#" method="get">
<fieldset>
<h3>Validation with Custom Error Messaging</h3>
<div class="form-group">
<label for="age">Enter a Number from 20-30</label>
<input type="number" class="form-control" id="customnumber" name="customnumber" min="20" max="30" title="Enter a Valid Number" required>
</div>
<div class="form-group">
<label for="age">This has a custom message</label>
<input type="text" class="form-control" id="customtext" name="customtext" title="Title Message" required>
</div>
<button type="submit" class="btn btn-primary btn-lg">Submit</button>
</form> -->
</div>
<div class="col-xs-12 center">
<div class="social">
<div class="fb-like" data-href="http://zaneray.github.io/scrupulous/" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div>
<div class="g-plusone" data-size="medium" data-annotation="none"></div>
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://zaneray.github.io/scrupulous/" data-text="Check out simple #html5 form #validation with Scrupulous.js" data-via="zaneraygroup">Tweet</a>
</div>
Brought to you by the folks at<br>
<a href="http://www.zaneray.com"><img src="images/ZR-logo.png" alt="The ZaneRay Group"></a>
</div>
<script src="js/vendor/jquery-1.10.2.min.js"></script>
<script src="js/scrupulous.js"></script>
<script>
$(function(){
$('.validate-form').scrupulous();
$('.callback-form').scrupulous({
valid: function(){
alert('Valid Callback - Submit the Form');
return true;
},
invalid: function(){
alert('Invalid Callback - Stop the Form');
return false;
}
});
$('#toggle-disabled').on('change',function(){
if($(this).is(':checked')){
$('#disabled-input').removeAttr('disabled');
}
else {
$('#disabled-input').attr('disabled',true);
}
});
});
</script>
<!-- Social Networking Crap -->
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=243234045767029";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/platform.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
</body>
</html>