PageSourceSearch

https://iod.gov.ua/template/js/forms/clearFieldsNoclear.js?1

js iod.gov.ua collected 2026-10-02 08:04:23 UTC 17,900 bytes, 403 lines download raw bytes

1function clearFieldsNoclear(form,warningbad,submitafter,errorlogin,errorpassword,erroremail,waytoform,tokenid,actionid,sitekey)
2{
3    var thisFormDiv = document.getElementById(form+'_div');
4    var inputs = thisFormDiv.getElementsByTagName('input');
5    var selects = thisFormDiv.getElementsByTagName('select');
6    var textareas = thisFormDiv.getElementsByTagName('textarea');
7    var formWarning = document.getElementById(form+'_warning');
8
9    var counter = 0;
10
11
12
13
14
15
16    //Проверяем, заполнены ли поля, в которых стоит required
17    for (var i = 0; i < inputs.length; i++)
18    {
19        var thisInput = inputs[i];
20        var titlewarned = document.getElementById(inputs[i].id+'_title');
21        var required = thisInput.required;
22        if (required == true)
23        {
24            if (thisInput.type != 'radio' && thisInput.type != 'checkbox' && thisInput.type != 'button')
25            {
26                if (thisInput.value=='')
27                {
28                    thisInput.classList.add('form_row_field_input_warned');
29                    if(titlewarned){titlewarned.classList.add('form_row_field_title_warned');};
30                    counter++;
31                }
32                else
33                {
34                    var thisInputValue = thisInput.value;
35                    if (thisInput.classList.contains('form_row_field_input_login'))
36                    {
37                        if(/^[a-zA-Z0-9]{2,20}$/.test(thisInputValue) === false)
38                        {
39                            thisInput.classList.add('form_row_field_input_warned');
40                            if(titlewarned){titlewarned.classList.add('form_row_field_title_warned');};
41                            thisInput.value='';
42                            thisInput.placeholder=errorlogin;
43                            counter++;
44                        }
45                        else
46                        {
47                            thisInput.classList.remove('form_row_field_input_warned');
48                            if(titlewarned){titlewarned.classList.remove('form_row_field_title_warned');};
49                        }
50                    }
51                    else if (thisInput.classList.contains('form_row_field_input_password'))
52                    {
53                        if(/^[a-zA-Z0-9]{6,20}$/.test(thisInputValue) === false)
54                        {
55                            thisInput.classList.add('form_row_field_input_warned');
56                            if(titlewarned){titlewarned.classList.add('form_row_field_title_warned');};
57                            thisInput.value='';
58                            thisInput.placeholder=errorpassword;
59                            counter++;
60                        }
61                        else
62                        {
63                            thisInput.classList.remove('form_row_field_input_warned');
64                            if(titlewarned){titlewarned.classList.remove('form_row_field_title_warned');};
65                        }
66                    }
67                    else if (thisInput.classList.contains('form_row_field_input_email'))
68                    {
69                        if ((thisInputValue.match(/.+?\@.+/g) || []).length !== 1)
70                        {
71                            thisInput.classList.add('form_row_field_input_warned');
72                            if(titlewarned){titlewarned.classList.add('form_row_field_title_warned');};
73                            thisInput.value='';
74                            thisInput.placeholder=erroremail;
75                            counter++;
76                        }
77                        else
78                        {
79                            thisInput.classList.remove('form_row_field_input_warned');
80                            if(titlewarned){titlewarned.classList.remove('form_row_field_title_warned');};
81                        }
82                    }
83
84                    // Отдельные условия для формы в личном кабинете
85                    else if (thisInput.id == 'form5_1_1')
86                    {
87                        if(/^[а-яА-ЯёЁіІїЇ\-\'\"\'‎\’‎\:\ ]{2,25}$/.test(thisInputValue) === false)
88                        {
89                            thisInput.classList.add('form_row_field_input_warned');
90                            if(titlewarned){titlewarned.classList.add('form_row_field_title_warned');};
91                            thisInput.value='';
92                            thisInput.placeholder='Від 2 до 25 літер кирилицею';
93                            counter++;
94                        }
95                        else
96                        {
97                            thisInput.classList.remove('form_row_field_input_warned');
98                            if(titlewarned){titlewarned.classList.remove('form_row_field_title_warned');};
99                        }
100                    }
101                    else if (thisInput.id == 'form5_1_2')
102                    {
103                        if(/^[а-яА-ЯёЁіІїЇ\-\'\"\'‎\’‎\:\ ]{2,25}$/.test(thisInputValue) === false)
104                        {
105                            thisInput.classList.add('form_row_field_input_warned');
106                            if(titlewarned){titlewarned.classList.add('form_row_field_title_warned');};
107                            thisInput.value='';
108                            thisInput.placeholder='Від 2 до 25 літер кирилицею';
109                            counter++;
110                        }
111                        else
112                        {
113                            thisInput.classList.remove('form_row_field_input_warned');
114                            if(titlewarned){titlewarned.classList.remove('form_row_field_title_warned');};
115                        }
116                    }
117                    else if (thisInput.id == 'form5_1_3')
118                    {
119                        if(/^[а-яА-ЯёЁіІїЇ\-\'\"\'‎\’‎\:\ ]{2,25}$/.test(thisInputValue) === false)
120                        {
121                            thisInput.classList.add('form_row_field_input_warned');
122                            if(titlewarned){titlewarned.classList.add('form_row_field_title_warned');};
123                            thisInput.value='';
124                            thisInput.placeholder='Від 2 до 25 літер кирилицею';
125                            counter++;
126                        }
127                        else
128                        {
129                            thisInput.classList.remove('form_row_field_input_warned');
130                            if(titlewarned){titlewarned.classList.remove('form_row_field_title_warned');};
131                        }
132                    }
133
134                    else
135                    {
136                        thisInput.classList.remove('form_row_field_input_warned');
137                        if(titlewarned){titlewarned.classList.remove('form_row_field_title_warned');};
138                    }
139                }
140            }
141
142            if (thisInput.type == 'radio' || thisInput.type == 'checkbox')
143            {
144                var titlewarned = thisInput.parentNode.parentNode.parentNode.firstElementChild;
145                var thisInputName = thisInput.name;
146                var thisCheckableInputs = document.getElementsByName(thisInputName);
147                for (var k = 0; k < thisCheckableInputs.length; k++)
148                {
149                    if (thisCheckableInputs[k].checked)
150                    {
151                        for (var z = 0; z < thisCheckableInputs.length; z++)
152                        {
153                            var thisLabel = document.getElementById(thisCheckableInputs[z].id+"_label");
154                            thisLabel.classList.remove('form_row_field_title_warned');
155                            if(titlewarned){titlewarned.classList.remove('form_row_field_title_warned');};
156                            var counteraddition = 0;
157                        }
158                        break;
159                    }
160                    else
161                    {
162                        var thisLabel = document.getElementById(thisCheckableInputs[k].id+"_label");
163                        thisLabel.classList.add('form_row_field_title_warned');
164                        if(titlewarned){titlewarned.classList.add('form_row_field_title_warned');};
165                        var counteraddition = 1;
166                    }
167                }
168                counter = counter+ +counteraddition;
169            }
170        }
171    }
172
173
174
175
176
177    for (var s = 0; s < selects.length; s++)
178    {
179        var thisSelect = selects[s];
180        var titlewarned = document.getElementById(selects[s].id+'_title');
181
182        if (thisSelect.id == 'form5_3_1')
183        {
184            if (thisSelect.value == 'all' || thisSelect.value == '0' || thisSelect.value == '')
185            {
186                thisSelect.classList.add('form_row_field_input_warned');
187                if(titlewarned){titlewarned.classList.add('form_row_field_title_warned');};
188                thisSelect.value='';
189                thisSelect.placeholder='Введіть день народження';
190                counter++;
191            }
192            else
193            {
194                thisSelect.classList.remove('form_row_field_input_warned');
195                if(titlewarned){titlewarned.classList.remove('form_row_field_title_warned');};
196            }
197        }
198        if (thisSelect.id == 'form5_3_2')
199        {
200            if (thisSelect.value == 'all' || thisSelect.value == '0' || thisSelect.value == '')
201            {
202                thisSelect.classList.add('form_row_field_input_warned');
203                if(titlewarned){titlewarned.classList.add('form_row_field_title_warned');};
204                thisSelect.value='';
205                thisSelect.placeholder='Введіть місяць народження';
206                counter++;
207            }
208            else
209            {
210                thisSelect.classList.remove('form_row_field_input_warned');
211                if(titlewarned){titlewarned.classList.remove('form_row_field_title_warned');};
212            }
213        }
214        if (thisSelect.id == 'form5_3_3')
215        {
216            if (thisSelect.value == 'all' || thisSelect.value == '0' || thisSelect.value == '')
217            {
218                thisSelect.classList.add('form_row_field_input_warned');
219                if(titlewarned){titlewarned.classList.add('form_row_field_title_warned');};
220                thisSelect.value='';
221                thisSelect.placeholder='Введіть рік народження';
222                counter++;
223            }
224            else
225            {
226                thisSelect.classList.remove('form_row_field_input_warned');
227                if(titlewarned){titlewarned.classList.remove('form_row_field_title_warned');};
228            }
229        }
230        if (thisSelect.id == 'form15_6_1')
231        {
232            if (thisSelect.value == 'all' || thisSelect.value == '0' || thisSelect.value == '')
233            {
234                thisSelect.classList.add('form_row_field_input_warned');
235                if(titlewarned){titlewarned.classList.add('form_row_field_title_warned');};
236                thisSelect.value='';
237                thisSelect.placeholder='Оберіть форму участі у заході';
238                counter++;
239            }
240            else
241            {
242                thisSelect.classList.remove('form_row_field_input_warned');
243                if(titlewarned){titlewarned.classList.remove('form_row_field_title_warned');};
244            }
245        }
246        if (thisSelect.id == 'form15_10_1')
247        {
248            if (thisSelect.value == 'all' || thisSelect.value == '0' || thisSelect.value == '')
249            {
250                thisSelect.classList.add('form_row_field_input_warned');
251                if(titlewarned){titlewarned.classList.add('form_row_field_title_warned');};
252                thisSelect.value='';
253                thisSelect.placeholder='Оберіть  область або місто';
254                counter++;
255            }
256            else
257            {
258                thisSelect.classList.remove('form_row_field_input_warned');
259                if(titlewarned){titlewarned.classList.remove('form_row_field_title_warned');};
260            }
261        }
262    }
263
264
265
266
267
268
269    var form5_5_1_1 = document.getElementById('form5_5_1_1');
270    if(form5_5_1_1)
271    {
272        if (form5_5_1_1.checked)
273        {
274            var form5_6_1 = document.getElementById('form5_6_1');
275            var titlewarned = document.getElementById('form5_6_1_title');
276            if (form5_6_1.value == 'all' || form5_6_1.value == '0' || form5_6_1.value == '')
277            {
278                form5_6_1.classList.add('form_row_field_input_warned');
279                if(titlewarned){titlewarned.classList.add('form_row_field_title_warned');};
280                form5_6_1.value='';
281                form5_6_1.placeholder='Введіть місяць народження';
282                counter++;
283            }
284            else
285            {
286                form5_6_1.classList.remove('form_row_field_input_warned');
287                if(titlewarned){titlewarned.classList.remove('form_row_field_title_warned');};
288            }
289
290            var form5_6_2 = document.getElementById('form5_6_2');
291            var titlewarned = document.getElementById('form5_6_2_title');
292            if (form5_6_2.value == 'all' || form5_6_2.value == '0' || form5_6_2.value == '')
293            {
294                form5_6_2.classList.add('form_row_field_input_warned');
295                if(titlewarned){titlewarned.classList.add('form_row_field_title_warned');};
296                form5_6_2.value='';
297                form5_6_2.placeholder='Введіть місяць народження';
298                counter++;
299            }
300            else
301            {
302                form5_6_2.classList.remove('form_row_field_input_warned');
303                if(titlewarned){titlewarned.classList.remove('form_row_field_title_warned');};
304            }
305
306            var form5_6_3 = document.getElementById('form5_6_3');
307            var titlewarned = document.getElementById('form5_6_3_title');
308            if (form5_6_3.value == 'all' || form5_6_3.value == '0' || form5_6_3.value == '')
309            {
310                form5_6_3.classList.add('form_row_field_input_warned');
311                if(titlewarned){titlewarned.classList.add('form_row_field_title_warned');};
312                form5_6_3.value='';
313                form5_6_3.placeholder='Введіть місяць народження';
314                counter++;
315            }
316            else
317            {
318                form5_6_3.classList.remove('form_row_field_input_warned');
319                if(titlewarned){titlewarned.classList.remove('form_row_field_title_warned');};
320            }
321
322            var form5_8_1 = document.getElementById('form5_8_1');
323            var titlewarned = document.getElementById('form5_8_1_title');
324            if (form5_8_1.value == 'all' || form5_8_1.value == '0' || form5_8_1.value == '')
325            {
326                form5_8_1.classList.add('form_row_field_input_warned');
327                if(titlewarned){titlewarned.classList.add('form_row_field_title_warned');};
328                form5_8_1.value='';
329                form5_8_1.placeholder='Введіть місяць народження';
330                counter++;
331            }
332            else
333            {
334                form5_8_1.classList.remove('form_row_field_input_warned');
335                if(titlewarned){titlewarned.classList.remove('form_row_field_title_warned');};
336            }
337        }
338    }
339
340
341
342
343
344
345    var form5_5_1_2 = document.getElementById('form5_5_1_2');
346    if(form5_5_1_2)
347    {
348        if (form5_5_1_2.checked)
349        {
350            var form5_9_1 = document.getElementById('form5_9_1');
351            var titlewarned = document.getElementById('form5_9_1_title');
352            if (form5_9_1.value == 'all' || form5_9_1.value == '0' || form5_9_1.value == '')
353            {
354                form5_9_1.classList.add('form_row_field_input_warned');
355                if(titlewarned){titlewarned.classList.add('form_row_field_title_warned');};
356                form5_9_1.value='';
357                form5_9_1.placeholder='Введіть місяць
357 народження';
358                counter++;
359            }
360            else
361            {
362                form5_9_1.classList.remove('form_row_field_input_warned');
363                if(titlewarned){titlewarned.classList.remove('form_row_field_title_warned');};
364            }
365
366            var form5_9_2 = document.getElementById('form5_9_2');
367            var titlewarned = document.getElementById('form5_9_2_title');
368            if (form5_9_2.value == 'all' || form5_9_2.value == '0' || form5_9_2.value == '')
369            {
370                form5_9_2.classList.add('form_row_field_input_warned');
371                if(titlewarned){titlewarned.classList.add('form_row_field_title_warned');};
372                form5_9_2.value='';
373                form5_9_2.placeholder='Введіть місяць народження';
374                counter++;
375            }
376            else
377            {
378                form5_9_2.classList.remove('form_row_field_input_warned');
379                if(titlewarned){titlewarned.classList.remove('form_row_field_title_warned');};
380            }
381        }
382    }
383
384
385
386
387
388
389    //Если все поля, в которых стоит required заполнены, то:
390    if (counter == 0)
391    {
392        preloaderShow('#'+form+'_preloader');
393
394        ajaxFormSend(form+'_warning', form, waytoform, submitafter);
395
396        setCaptchaToken(tokenid,actionid,sitekey);
397    }
398    else
399    {
400        formWarning.className='form_row_warning warned';
401        formWarning.innerHTML=warningbad;
402    }
403}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.