Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
K
kpp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alexandr Veselov
kpp
Commits
d3a623b5
Commit
d3a623b5
authored
Mar 04, 2019
by
Nikolay Gromov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Валидация формы: правка
parent
49b5d0a3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
form-validation.js
src/blocks/form-validation/form-validation.js
+1
-1
No files found.
src/blocks/form-validation/form-validation.js
View file @
d3a623b5
...
@@ -30,6 +30,7 @@ ready(function(){
...
@@ -30,6 +30,7 @@ ready(function(){
const
fieldsText
=
Array
.
from
(
document
.
querySelectorAll
(
'input[data-check-pattern]'
));
const
fieldsText
=
Array
.
from
(
document
.
querySelectorAll
(
'input[data-check-pattern]'
));
fieldsText
.
forEach
(
function
(
input
){
fieldsText
.
forEach
(
function
(
input
){
input
.
addEventListener
(
'blur'
,
function
(){
checkFieldText
(
input
);
});
input
.
addEventListener
(
'blur'
,
function
(){
checkFieldText
(
input
);
});
input
.
addEventListener
(
'keyup'
,
function
(){
checkFieldText
(
input
);
});
});
});
// Для всех проверяемых чекбоксов
// Для всех проверяемых чекбоксов
...
@@ -39,7 +40,6 @@ ready(function(){
...
@@ -39,7 +40,6 @@ ready(function(){
});
});
function
checkFieldText
(
input
)
{
function
checkFieldText
(
input
)
{
input
.
addEventListener
(
'input'
,
function
(){
checkFieldText
(
input
);
});
const
regExp
=
new
RegExp
(
input
.
dataset
.
checkPattern
,
'gi'
);
const
regExp
=
new
RegExp
(
input
.
dataset
.
checkPattern
,
'gi'
);
const
result
=
regExp
.
test
(
input
.
value
);
const
result
=
regExp
.
test
(
input
.
value
);
const
errorClass
=
'field-text--error'
;
const
errorClass
=
'field-text--error'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment