forked from posabsolute/jQuery-Validation-Engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemoValidators.ja.html
209 lines (208 loc) · 8.51 KB
/
demoValidators.ja.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>JQuery Validation Engine</title>
<link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/>
<link rel="stylesheet" href="css/template.css" type="text/css"/>
<script src="js/jquery-1.4.4.min.js" type="text/javascript">
</script>
<script src="js/jquery.validationEngine-ja.js" type="text/javascript" charset="utf-8">
</script>
<script src="js/jquery.validationEngine.js" type="text/javascript" charset="utf-8">
</script>
<script>
jQuery(document).ready(function(){
// binds form submission and fields to the validation engine
jQuery("#formID").validationEngine();
});
/**
*
* @param {jqObject} the field where the validation applies
* @param {Array[String]} validation rules for this field
* @param {int} rule index
* @param {Map} form options
* @return an error string if validation failed
*/
function checkHELLO(field, rules, i, options){
if (field.val() != "HELLO") {
// this allows to use i18 for the error msgs
return options.allrules.validate2fields.alertText;
}
}
</script>
</head>
<body>
<p>
<a href="#" onclick="alert('is the form valid? '+jQuery('#formID').validationEngine('validate'))">Evaluate form</a>
| <a href="#" onclick="jQuery('#formID').validationEngine('showPrompt', 'This is an example', 'pass')">Build a prompt on a div</a>
| <a href="#" onclick="jQuery('#formID').validationEngine('hide')">Close all prompts</a>
| <a href="index.html" >Back to index</a>
</p>
<p>
This demonstration shows the different validators available
<br/>
</p>
<form id="formID" class="formular" method="post" action="">
<fieldset>
<legend>
Required
</legend>
<label>
<span>Field is required : </span>
<input value="" class="validate[required] text-input" type="text" name="req" id="req" />
</label>
<label>
<span>Favorite sport 1:</span>
<select name="sport" id="sport" class="validate[required]">
<option value="">Choose a sport</option>
<option value="option1">Tennis</option>
<option value="option2">Football</option>
<option value="option3">Golf</option>
</select>
</label>
<label>
<span>Favorite sport 2:</span>
<select name="sport2" id="sport2" multiple class="validate[required]">
<option value="">Choose a sport</option>
<option value="option1">Tennis</option>
<option value="option2">Football</option>
<option value="option3">Golf</option>
</select>
</label>
<br/>
validate[required]
</fieldset>
<fieldset>
<legend>
Custom
</legend>
<label>
Comes with many predifined regex (phone, url, ip, email..etc) <a href="demoRegExp.html">[DEMO]</a>
<br/>
<span>Enter a URL : </span>
<input value="http://" class="validate[required,custom[url]] text-input" type="text" name="url" id="url" />
<br/>
validate[required,custom[url]]
</label>
</fieldset>
<fieldset>
<legend>
Equals
</legend>
<label>
<span>Password : </span>
<input value="karnius" class="validate[required] text-input" type="password" name="password" id="password" />
</label>
<label>
<span>Confirm password : </span>
<input value="kaniusBAD" class="validate[required,equals[password]] text-input" type="password" name="password2" id="password2" />
<br/>
validate[required,equals[password]]
</label>
</fieldset>
<fieldset>
<legend>
Function
</legend>
<label>
<span>Write 'HELLO' : </span>
<input value="" class="validate[required,funcCall[checkHELLO]] text-input" type="text" id="lastname" name="lastname" />
<br/>
validate[required,funcCall[checkHELLO]]
</label>
</fieldset>
<fieldset>
<legend>
MinSize
</legend>
<label>
Minimum field size
<br/>
<input value="" class="validate[required,minSize[6]] text-input" type="text" name="minsize" id="minsize" />
<br/>
validate[required,minSize[6]]
</label>
</fieldset>
<fieldset>
<legend>
MaxSize
</legend>
<label>
Maximum field size
<br/>
<input value="0123456789" class="validate[required,maxSize[6]] text-input" type="text" name="maxsize" id="maxsize" />
<br/>
validate[required,maxSize[6]]
</label>
</fieldset>
<fieldset>
<legend>
Min
</legend>
<label>
integer >= -5
<br/>
<input value="-7" class="validate[required,custom[integer],min[-5]] text-input" type="text" name="min" id="min" />
<br/>
validate[required,custom[integer],min[-5]]
</label>
</fieldset>
<fieldset>
<legend>
Max
</legend>
<label>
integer ,50]
<br/>
<input value="55" class="validate[required,custom[integer],max[50]] text-input" type="text" name="max" id="max" />
<br/>
validate[required,custom[integer],max[50]]
</label>
</fieldset>
<fieldset>
<legend>
Past
</legend>
<label>
Checks that the value is a date in the past
<br/>
<span>Please enter a date ealier than 2010/01/01</span>
<input value="2009/06/30" class="validate[custom[date],past[2010/01/01]] text-input" type="text" name="past" id="past" />
<br/>
validate[custom[date],past[2010/01/01]]
</label>
</fieldset>
<fieldset>
<legend>
Future
</legend>
<label>
Checks that the value is a date in the future
<br/>
<span>Please enter a date older than today's date</span>
<input value="2011-01-" class="validate[custom[date],future[NOW]] text-input" type="text" name="future" id="future" />
<br/>
validate[custom[date],future[NOW]]
</label>
</fieldset>
<fieldset>
<legend>
Checkbox
</legend>
<label>
Check this <a href="demoCheckbox.html">[DEMO]</a>
</label>
</fieldset>
<fieldset>
<legend>
Ajax
</legend>
<label>
Check this <a href="demoAjax.html">[DEMO]</a>
</label>
</fieldset>
<input class="submit" type="submit" value="Validate & Send the form!"/><hr/>
</form>
</body>
</html>