-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
293 lines (272 loc) · 14.1 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
287
288
289
290
291
292
293
<!DOCTYPE html>
<html>
<head>
<title>JQuery-validation demo | Bootstrap</title>
<meta charset="UTF-8">
<!-- frameworks -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- libs -->
<script src="dist/libs/jquery.maskedinput.js"></script>
<script src="dist/js/jquery.citrusValidator.js"></script>
<script src="dist/js/lang/ru.js"></script>
<link rel="stylesheet" href="dist/css/jquery.citrusValidator.min.css">
<script>
$(function() {
//Основная форма
window.form = new citrusValidator($("#signupForm1"));
$(".phone_mask").mask("+7 (999) 999-99-99");
$(".snils-mask").mask("999-999-999 99");
//вызов через плагин с удалением объекта при совпадении
//$("form").citrusValidator({checkInit:false});
//получение объекта валидатора через плагин
//console.log($("form").citrusValidator('get'));
var $orderForm = $('#order-form');
window.orderValidator = new citrusValidator($orderForm);
$orderForm
.on('click', '.js-form-fill', function (event) {
event.preventDefault();
$orderForm.find('[type="text"], textarea').each(function (index, item) {
$(item).val($(item).attr('placeholder'));
});
orderValidator.validateField(orderValidator.fields);
})
.on('click','.js-attach-events', orderValidator.attachEvents)
.on('click','.js-detach-events', orderValidator.detachEvents)
.on('click','.js-destroy', orderValidator.destroy)
.on('click','.js-init', orderValidator.init);
var registerValidator = new citrusValidator($('#register'));
});
</script>
</head>
<body>
<p><br></p>
<div class="container">
<div class="row">
<div class="col-sm-12">
<form action="" class="form-horizontal" id="order-form">
<h2>Оформление заказа</h2>
<div class="form-group">
<label class="col-sm-4 control-label" for="">ИНН<span class="red">*</span></label>
<div class="col-sm-6 input-container">
<input data-valid="inn required" type="text" class="form-control" name="inn" placeholder="7750004305" id="inn" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="">ИНН юр лица</label>
<div class="col-sm-6 input-container">
<input data-valid="inn_u" type="text" class="form-control" name="inn_u" placeholder="1234567894" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="">ИНН физ лица</label>
<div class="col-sm-6 input-container">
<input data-valid="inn_f" type="text" class="form-control" name="inn_f" placeholder="054302743481" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="">ОГРН</label>
<div class="col-sm-6 input-container">
<input data-valid="ogrn" type="text" class="form-control" name="ogrn" placeholder="5077746887312" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="">КПП</label>
<div class="col-sm-6 input-container">
<input data-valid="kpp" type="text" class="form-control" name="kpp" placeholder="771401001" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="">Бик</label>
<div class="col-sm-6 input-container">
<input data-valid="bik" type="text" class="form-control" name="bik" placeholder="044525451" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="">К/счет</label>
<div class="col-sm-6 input-container">
<input data-valid="ks" type="text" class="form-control" name="ks" placeholder="30101810545250000451" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="">Р/счет</label>
<div class="col-sm-6 input-container">
<input data-valid="rs" type="text" class="form-control" name="rs" placeholder="40701810300000000004" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="">Снилс</label>
<div class="col-sm-6 input-container">
<input data-valid="snils" type="text" class="form-control snils-mask" name="snils" placeholder="116-973-385 89" />
</div>
</div>
<div class="form-group">
<div class="col-sm-9 col-sm-offset-4">
<button type="submit" class="btn btn-primary" name="" value="" >Отправить</button>
<button type="button" class="btn btn-secondary js-form-fill" name="" value="" >Заполнить форму</button>
</div>
</div>
<div class="form-group">
<div class="col-sm-9 col-sm-offset-4">
<button type="button" class="btn btn-secondary js-attach-events" name="" value="" >attachEvents()</button>
<button type="button" class="btn btn-secondary js-detach-events" name="" value="" >detachEvents()</button>
</div>
</div>
<div class="form-group">
<div class="col-sm-9 col-sm-offset-4">
<button type="button" class="btn btn-secondary js-init" name="" value="" >init()</button>
<button type="button" class="btn btn-secondary js-destroy" name="" value="" >destroy()</button>
</div>
</div>
</form>
<form action="" class="form-horizontal" id="register">
<h2>Регистрация</h2>
<div class="form-group">
<label class="col-sm-4 control-label" for="">Логин:<span class="red">*</span></label>
<div class="col-sm-6 input-container">
<input class="form-control" data-valid="login required length" data-valid-param-minlength="4" type="password" placeholder="Логин" name="pass" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="">Пароль:<span class="red">*</span></label>
<div class="col-sm-6 input-container">
<input class="form-control" data-valid="main_password required length" data-valid-param-minlength="4" type="password" placeholder="Пароль" name="pass" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="">Повтор пароля:<span class="red">*</span></label>
<div class="col-sm-6 input-container">
<input class="form-control" data-valid="confirm_password required" type="password" placeholder="Повторите пароль" name="pass_confirm" />
</div>
</div>
<div class="form-group">
<div class="col-sm-9 col-sm-offset-4">
<button type="submit" class="btn btn-primary" name="" value="" >Отправить</button>
</div>
</div>
</form>
<h1>Валидация полей</h1>
<div class="panel panel-default">
<div class="panel-body">
<form id="signupForm1" method="post" class="form-validate form-horizontal" action="" autocomplete="off">
<div class="form-group">
<label class="col-sm-4 control-label" for="email">Цена:</label>
<div class="input-container">
<div class="col-sm-3">
<input placeholder="от" data-valid-params = '{"requireGroup":2, "groupLogic": "and", "name": "от"}' type="text" class="form-control" name="email1"/>
</div>
<div class="col-sm-1 text-center">
и
</div>
<div class="col-sm-4">
<input placeholder="до" data-valid-params = '{"requireGroup":2, "logic": "and", "name": "до"}' type="text" class="form-control" name="email1"/>
</div>
<div class="col-sm-4"></div><div class="col-sm-8"><div class="group-error help-block"></div></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="email">Email:</label>
<div class="col-sm-6 input-container">
<input data-valid="email" data-valid-params = '{"requireGroup":1, "name": "email"}' type="email" class="form-control" name="email1" placeholder="[email protected]" id="email"/>
</div>
</div>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-4">
<b>или</b>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="">Телефон:</label>
<div class="col-sm-6 input-container">
<input data-valid="phone_all" data-valid-params = '{"requireGroup":1, "name": "телефон"}' type="text" class="form-control" name="phone" placeholder="99-99-99 или +7 (999) 999-99-99" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="">Email или Телефон:</label>
<div class="col-sm-6 input-container">
<input data-valid="ruleGroup" data-valid-params = '{"ruleGroup": ["email", "phone_all"]}' data-valid-messages = '{"ruleGroup": "Пожалуйста, введите корректный email или телефон"}' type="text" class="form-control" name="phone" placeholder="" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="">Имя (аякс + триггер):<span class="red">*</span></label>
<div class="col-sm-6 input-container">
<input data-valid="ajax required" data-valid-params = '{"ajaxUrl":"ajax.php", "trigger": "change"}' data-ajax-url="ajax.php" data-validate-trigger ="change" type="text" class="form-control" name="firstname" placeholder="Проверка имени на уникальность" id="ajax"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="">Длина строки:<span class="red">*</span></label>
<div class="col-sm-6 input-container">
<input data-valid="length" data-valid-params = '{"minlength":2,"maxlength":6}' type="text" class="form-control" name="uname" placeholder="от 2 до 6" id="length"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="">Федеральный номер телефона (маска):<span class="red">*</span></label>
<div class="col-sm-6 input-container">
<input data-valid="phone required" type="text" class="form-control phone_mask" name="phone1" placeholder="+7 (999) 999-99-99" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="">Число (не менее 100 и не более 1000): </label>
<div class="col-sm-6 input-container">
<input data-valid="number" type="text" class="form-control" name="number1" data-valid-params='{"min": 100, "max":1000}' placeholder="Число" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label " for="">URL</label>
<div class="col-sm-6 input-container">
<input data-valid="url" type="text" class="form-control" name="url" placeholder="http://example.ru" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="">Сообщение</label>
<div class="col-sm-6 input-container">
<textarea class="form-control" name="big_text" id="" cols="30" rows="10"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-5 col-sm-offset-4 input-container">
<div class="radio">
<label>
<input data-valid="required" type="radio" name="underwear" >
Boxers
</label>
</div>
<div class="radio">
<label>
<input data-valid="required" type="radio" name="underwear" >
Briefs
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-5 col-sm-offset-4">
<div class="checkbox input-container">
<label>
<input data-valid="required" data-valid-params='{"important":1}' type="checkbox" id="agree1" name="agree12" value="agree" />Я согласен на обработку моих данных.
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-5 col-sm-offset-4">
<div class="checkbox input-container">
<label>
<input data-valid="required" data-valid-params='{"important":1}' type="checkbox" id="agree2" name="agree22" value="agree" />Я прочитал пользовательское соглашение.
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-9 col-sm-offset-4">
<button type="submit" class="btn btn-primary" name="signup1" value="Sign up">Валидация</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</body>
</html>