Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
cd898c1b
Commit
cd898c1b
authored
May 23, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3558 from creocoder/range-validator-js-enh
[WIP] Additional RangeValidator fixes
parents
e1b47770
12a143bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
4 deletions
+21
-4
yii.validation.js
framework/assets/yii.validation.js
+17
-3
RangeValidator.php
framework/validators/RangeValidator.php
+4
-1
No files found.
framework/assets/yii.validation.js
View file @
cd898c1b
...
...
@@ -91,10 +91,24 @@ yii.validation = (function ($) {
if
(
options
.
skipOnEmpty
&&
pub
.
isEmpty
(
value
))
{
return
;
}
var
valid
=
!
options
.
not
&&
$
.
inArray
(
value
,
options
.
range
)
>
-
1
||
options
.
not
&&
$
.
inArray
(
value
,
options
.
range
)
==
-
1
;
if
(
!
valid
)
{
if
(
!
options
.
allowArray
&&
$
.
isArray
(
value
))
{
pub
.
addMessage
(
messages
,
options
.
message
,
value
);
return
;
}
var
inArray
=
true
;
$
.
each
(
$
.
isArray
(
value
)
?
value
:
[
value
],
function
(
i
,
v
)
{
if
(
$
.
inArray
(
v
,
options
.
range
)
==
-
1
)
{
inArray
=
false
;
return
false
;
}
else
{
return
true
;
}
});
if
(
options
.
not
!==
inArray
)
{
pub
.
addMessage
(
messages
,
options
.
message
,
value
);
}
},
...
...
framework/validators/RangeValidator.php
View file @
cd898c1b
...
...
@@ -72,7 +72,7 @@ class RangeValidator extends Validator
}
}
return
(
$this
->
not
xor
$in
)
?
null
:
[
$this
->
message
,
[]];
return
$this
->
not
!==
$in
?
null
:
[
$this
->
message
,
[]];
}
/**
...
...
@@ -94,6 +94,9 @@ class RangeValidator extends Validator
if
(
$this
->
skipOnEmpty
)
{
$options
[
'skipOnEmpty'
]
=
1
;
}
if
(
$this
->
allowArray
)
{
$options
[
'allowArray'
]
=
1
;
}
ValidationAsset
::
register
(
$view
);
...
...
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