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
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
PSDI Army
yii2
Commits
4239b2a5
Commit
4239b2a5
authored
Jan 12, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #1870: Validation errors weren't properly translated when using clientside validation
parent
718ddfb9
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
39 additions
and
38 deletions
+39
-38
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
BooleanValidator.php
framework/validators/BooleanValidator.php
+4
-4
CompareValidator.php
framework/validators/CompareValidator.php
+4
-4
EmailValidator.php
framework/validators/EmailValidator.php
+2
-2
NumberValidator.php
framework/validators/NumberValidator.php
+8
-8
RangeValidator.php
framework/validators/RangeValidator.php
+2
-2
RegularExpressionValidator.php
framework/validators/RegularExpressionValidator.php
+2
-2
RequiredValidator.php
framework/validators/RequiredValidator.php
+4
-4
StringValidator.php
framework/validators/StringValidator.php
+10
-10
UrlValidator.php
framework/validators/UrlValidator.php
+2
-2
No files found.
framework/CHANGELOG.md
View file @
4239b2a5
...
...
@@ -24,6 +24,7 @@ Yii Framework 2 Change Log
-
Bug #1798: Fixed label attributes for array fields (zhuravljov)
-
Bug #1800: Better check for
`$_SERVER['HTTPS']`
in
`yii\web\Request::getIsSecureConnection()`
(ginus, samdark)
-
Bug #1827: Debugger toolbar is loaded twice if an action is calling
`run()`
to execute another action (qiangxue)
-
Bug #1870: Validation errors weren't properly translated when using clientside validation (samdark)
-
Bug: Fixed
`Call to a member function registerAssetFiles() on a non-object`
in case of wrong
`sourcePath`
for an asset bundle (samdark)
-
Bug: Fixed incorrect event name for
`yii\jui\Spinner`
(samdark)
-
Bug: Json::encode() did not handle objects that implement JsonSerializable interface correctly (cebe)
...
...
framework/validators/BooleanValidator.php
View file @
4239b2a5
...
...
@@ -72,10 +72,10 @@ class BooleanValidator extends Validator
$options
=
[
'trueValue'
=>
$this
->
trueValue
,
'falseValue'
=>
$this
->
falseValue
,
'message'
=>
strtr
(
$this
->
message
,
[
'
{attribute}
'
=>
$object
->
getAttributeLabel
(
$attribute
),
'
{true}
'
=>
$this
->
trueValue
,
'
{false}
'
=>
$this
->
falseValue
,
'message'
=>
Yii
::
t
(
'yii'
,
$this
->
message
,
[
'
attribute
'
=>
$object
->
getAttributeLabel
(
$attribute
),
'
true
'
=>
$this
->
trueValue
,
'
false
'
=>
$this
->
falseValue
,
]),
];
if
(
$this
->
skipOnEmpty
)
{
...
...
framework/validators/CompareValidator.php
View file @
4239b2a5
...
...
@@ -195,10 +195,10 @@ class CompareValidator extends Validator
$options
[
'skipOnEmpty'
]
=
1
;
}
$options
[
'message'
]
=
strtr
(
$this
->
message
,
[
'
{attribute}
'
=>
$object
->
getAttributeLabel
(
$attribute
),
'
{compareAttribute}
'
=>
$compareValue
,
'
{compareValue}
'
=>
$compareValue
,
$options
[
'message'
]
=
Yii
::
t
(
'yii'
,
$this
->
message
,
[
'
attribute
'
=>
$object
->
getAttributeLabel
(
$attribute
),
'
compareAttribute
'
=>
$compareValue
,
'
compareValue
'
=>
$compareValue
,
]);
ValidationAsset
::
register
(
$view
);
...
...
framework/validators/EmailValidator.php
View file @
4239b2a5
...
...
@@ -98,8 +98,8 @@ class EmailValidator extends Validator
'pattern'
=>
new
JsExpression
(
$this
->
pattern
),
'fullPattern'
=>
new
JsExpression
(
$this
->
fullPattern
),
'allowName'
=>
$this
->
allowName
,
'message'
=>
strtr
(
$this
->
message
,
[
'
{attribute}
'
=>
$object
->
getAttributeLabel
(
$attribute
),
'message'
=>
Yii
::
t
(
'yii'
,
$this
->
message
,
[
'
attribute
'
=>
$object
->
getAttributeLabel
(
$attribute
),
]),
'enableIDN'
=>
(
boolean
)
$this
->
enableIDN
,
];
...
...
framework/validators/NumberValidator.php
View file @
4239b2a5
...
...
@@ -124,23 +124,23 @@ class NumberValidator extends Validator
$options
=
[
'pattern'
=>
new
JsExpression
(
$this
->
integerOnly
?
$this
->
integerPattern
:
$this
->
numberPattern
),
'message'
=>
strtr
(
$this
->
message
,
[
'
{attribute}
'
=>
$label
,
'message'
=>
Yii
::
t
(
'yii'
,
$this
->
message
,
[
'
attribute
'
=>
$label
,
]),
];
if
(
$this
->
min
!==
null
)
{
$options
[
'min'
]
=
$this
->
min
;
$options
[
'tooSmall'
]
=
strtr
(
$this
->
tooSmall
,
[
'
{attribute}
'
=>
$label
,
'
{min}
'
=>
$this
->
min
,
$options
[
'tooSmall'
]
=
Yii
::
t
(
'yii'
,
$this
->
tooSmall
,
[
'
attribute
'
=>
$label
,
'
min
'
=>
$this
->
min
,
]);
}
if
(
$this
->
max
!==
null
)
{
$options
[
'max'
]
=
$this
->
max
;
$options
[
'tooBig'
]
=
strtr
(
$this
->
tooBig
,
[
'
{attribute}
'
=>
$label
,
'
{max}
'
=>
$this
->
max
,
$options
[
'tooBig'
]
=
Yii
::
t
(
'yii'
,
$this
->
tooBig
,
[
'
attribute
'
=>
$label
,
'
max
'
=>
$this
->
max
,
]);
}
if
(
$this
->
skipOnEmpty
)
{
...
...
framework/validators/RangeValidator.php
View file @
4239b2a5
...
...
@@ -73,8 +73,8 @@ class RangeValidator extends Validator
$options
=
[
'range'
=>
$range
,
'not'
=>
$this
->
not
,
'message'
=>
strtr
(
$this
->
message
,
[
'
{attribute}
'
=>
$object
->
getAttributeLabel
(
$attribute
),
'message'
=>
Yii
::
t
(
'yii'
,
$this
->
message
,
[
'
attribute
'
=>
$object
->
getAttributeLabel
(
$attribute
),
]),
];
if
(
$this
->
skipOnEmpty
)
{
...
...
framework/validators/RegularExpressionValidator.php
View file @
4239b2a5
...
...
@@ -80,8 +80,8 @@ class RegularExpressionValidator extends Validator
$options
=
[
'pattern'
=>
new
JsExpression
(
$pattern
),
'not'
=>
$this
->
not
,
'message'
=>
strtr
(
$this
->
message
,
[
'
{attribute}
'
=>
$object
->
getAttributeLabel
(
$attribute
),
'message'
=>
Yii
::
t
(
'yii'
,
$this
->
message
,
[
'
attribute
'
=>
$object
->
getAttributeLabel
(
$attribute
),
]),
];
if
(
$this
->
skipOnEmpty
)
{
...
...
framework/validators/RequiredValidator.php
View file @
4239b2a5
...
...
@@ -90,8 +90,8 @@ class RequiredValidator extends Validator
{
$options
=
[];
if
(
$this
->
requiredValue
!==
null
)
{
$options
[
'message'
]
=
strtr
(
$this
->
message
,
[
'
{requiredValue}
'
=>
$this
->
requiredValue
,
$options
[
'message'
]
=
Yii
::
t
(
'yii'
,
$this
->
message
,
[
'
requiredValue
'
=>
$this
->
requiredValue
,
]);
$options
[
'requiredValue'
]
=
$this
->
requiredValue
;
}
else
{
...
...
@@ -101,8 +101,8 @@ class RequiredValidator extends Validator
$options
[
'strict'
]
=
1
;
}
$options
[
'message'
]
=
strtr
(
$options
[
'message'
],
[
'
{attribute}
'
=>
$object
->
getAttributeLabel
(
$attribute
),
$options
[
'message'
]
=
Yii
::
t
(
'yii'
,
$options
[
'message'
],
[
'
attribute
'
=>
$object
->
getAttributeLabel
(
$attribute
),
]);
ValidationAsset
::
register
(
$view
);
...
...
framework/validators/StringValidator.php
View file @
4239b2a5
...
...
@@ -151,30 +151,30 @@ class StringValidator extends Validator
$label
=
$object
->
getAttributeLabel
(
$attribute
);
$options
=
[
'message'
=>
strtr
(
$this
->
message
,
[
'message'
=>
Yii
::
t
(
'yii'
,
$this
->
message
,
[
'{attribute}'
=>
$label
,
]),
];
if
(
$this
->
min
!==
null
)
{
$options
[
'min'
]
=
$this
->
min
;
$options
[
'tooShort'
]
=
strtr
(
$this
->
tooShort
,
[
'
{attribute}
'
=>
$label
,
'
{min}
'
=>
$this
->
min
,
$options
[
'tooShort'
]
=
Yii
::
t
(
'yii'
,
$this
->
tooShort
,
[
'
attribute
'
=>
$label
,
'
min
'
=>
$this
->
min
,
]);
}
if
(
$this
->
max
!==
null
)
{
$options
[
'max'
]
=
$this
->
max
;
$options
[
'tooLong'
]
=
strtr
(
$this
->
tooLong
,
[
'
{attribute}
'
=>
$label
,
'
{max}
'
=>
$this
->
max
,
$options
[
'tooLong'
]
=
Yii
::
t
(
'yii'
,
$this
->
tooLong
,
[
'
attribute
'
=>
$label
,
'
max
'
=>
$this
->
max
,
]);
}
if
(
$this
->
length
!==
null
)
{
$options
[
'is'
]
=
$this
->
length
;
$options
[
'notEqual'
]
=
strtr
(
$this
->
notEqual
,
[
'
{attribute}
'
=>
$label
,
'
{length}
'
=>
$this
->
length
,
$options
[
'notEqual'
]
=
Yii
::
t
(
'yii'
,
$this
->
notEqual
,
[
'
attribute
'
=>
$label
,
'
length
'
=>
$this
->
length
,
]);
}
if
(
$this
->
skipOnEmpty
)
{
...
...
framework/validators/UrlValidator.php
View file @
4239b2a5
...
...
@@ -121,8 +121,8 @@ class UrlValidator extends Validator
$options
=
[
'pattern'
=>
new
JsExpression
(
$pattern
),
'message'
=>
strtr
(
$this
->
message
,
[
'
{attribute}
'
=>
$object
->
getAttributeLabel
(
$attribute
),
'message'
=>
Yii
::
t
(
'yii'
,
$this
->
message
,
[
'
attribute
'
=>
$object
->
getAttributeLabel
(
$attribute
),
]),
'enableIDN'
=>
(
boolean
)
$this
->
enableIDN
,
];
...
...
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