-
Notifications
You must be signed in to change notification settings - Fork 0
/
w_validation.html
157 lines (155 loc) · 4.33 KB
/
w_validation.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
<form method="post" action="demo/common/ajaxDone.html" class="pageForm required-validate" onsubmit="return validateCallback(this)">
<div class="formBar card">
<ul>
<li><button class="buttonActive" type="submit">提交</button></li>
<li><button class="button close" type="button">关闭</button></li>
</ul>
</div>
<div class="card">
<div class="pageFormContent" layoutH>
<h2 class="contentTitle">表单验证</h2>
<dl>
<dt>必填:</dt>
<dd>
<input type="text" name="name" maxlength="20" class="required" />
<span class="info">class="required"</span>
</dd>
</dl>
<dl>
<dt>必填+邮箱:</dt>
<dd>
<input type="text" name="email" class="required email" alt="请输入您的电子邮件"/>
<span class="info">class="required email"</span>
</dd>
</dl>
<dl>
<dt>电话:</dt>
<dd>
<input type="text" name="phone" class="phone" alt="请输入您的电话"/>
<span class="info">class="phone"</span>
</dd>
</dl>
<dl>
<dt>密码:</dt>
<dd>
<input id="w_validation_pwd" type="password" name="password" class="required alphanumeric" minlength="6" maxlength="20" alt="字母、数字、下划线 6-20位"/>
<span class="info">class="required alphanumeric" minlength="6" maxlength="20"</span>
</dd>
</dl>
<dl>
<dt>确认密码:</dt>
<dd>
<input type="password" name="repassword" class="required" equalto="#w_validation_pwd"/>
<span class="info">class="required" equalto="#xxxId"</span>
</dd>
</dl>
<dl>
<dt>整数:</dt>
<dd>
<input type="text" name="digits" class="digits" />
<span class="info">class="digits"</span>
</dd>
</dl>
<dl>
<dt>浮点数:</dt>
<dd>
<input type="text" name="number" class="number" />
<span class="info">class="number"</span>
</dd>
</dl>
<dl>
<dt>最小值:</dt>
<dd>
<input type="text" name="min" min="1"/>
<span class="info">min="1"</span>
</dd>
</dl>
<dl>
<dt>最大值:</dt>
<dd>
<input type="text" name="max" max="10"/>
<span class="info">max="10"</span>
</dd>
</dl>
<dl>
<dt>最小值-最大值:</dt>
<dd>
<input type="text" name="min_max" min="1" max="10"/>
<span class="info">min="1" max="10"</span>
</dd>
</dl>
<dl>
<dt>最小长度:</dt>
<dd>
<input type="text" name="minlength_maxlength6" minlength="6" />
<span class="info">minlength="6"</span>
</dd>
</dl>
<dl>
<dt>最大长度:</dt>
<dd>
<input type="text" name="minlength_maxlength10" maxlength="10"/>
<span class="info">maxlength="10"</span>
</dd>
</dl>
<dl>
<dt>最小长度-最大长度:</dt>
<dd>
<input type="text" name="minlength_maxlength" minlength="6" maxlength="20"/>
<span class="info">minlength="6" maxlength="20"</span>
</dd>
</dl>
<dl>
<dt>信用卡:</dt>
<dd>
<input type="text" name="creditcard" class="creditcard" />
<span class="info">class="creditcard"</span>
</dd>
</dl>
<dl>
<dt>字母、数字、下划线:</dt>
<dd>
<input type="text" name="alphanumeric" class="alphanumeric" />
<span class="info">class="alphanumeric"</span>
</dd>
</dl>
<dl>
<dt>字母:</dt>
<dd>
<input type="text" name="lettersonly" class="lettersonly" />
<span class="info">class="lettersonly"</span>
</dd>
</dl>
<dl>
<dt>网址:</dt>
<dd>
<input type="text" name="url" class="url" />
<span class="info">class="url"</span>
</dd>
</dl>
<dl>
<dt>remote:</dt>
<dd>
<input type="text" name="remote" remote="validate_remote.html"/>
<span class="info">唯一性验证input添加属性:remote="xxxUrl"</span>
</dd>
</dl>
<dl>
<dt>customvalid+remote:</dt>
<dd>
<input type="text" name="remote2" remote="validate_remote.html" customvalid="customvalidXxx(element)"/>
<span class="info">customvalid="customvalidXxx(element)" | remote="xxxUrl"</span>
</dd>
</dl>
<div class="divider"></div>
<p>自定义扩展请参照:dwz.validate.method.js</p>
<p>错误提示信息国际化请参照:dwz.regional.zh.js</p>
</div>
</div>
</form>
<script type="text/javascript">
function customvalidXxx(element){
if ($(element).val() == "xxx") return false;
return true;
}
</script>