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
bf1b2d99
Commit
bf1b2d99
authored
May 15, 2013
by
resurtm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Form asset bundle registering code moved from ActiveForm::run() to the…
Form asset bundle registering code moved from ActiveForm::run() to the *Validator::clientValidateAttribute().
parent
f7b8595f
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
16 additions
and
9 deletions
+16
-9
BooleanValidator.php
yii/validators/BooleanValidator.php
+1
-0
CaptchaValidator.php
yii/validators/CaptchaValidator.php
+1
-0
CompareValidator.php
yii/validators/CompareValidator.php
+1
-0
EmailValidator.php
yii/validators/EmailValidator.php
+4
-4
NumberValidator.php
yii/validators/NumberValidator.php
+1
-0
RangeValidator.php
yii/validators/RangeValidator.php
+1
-0
RegularExpressionValidator.php
yii/validators/RegularExpressionValidator.php
+1
-0
RequiredValidator.php
yii/validators/RequiredValidator.php
+1
-0
StringValidator.php
yii/validators/StringValidator.php
+1
-0
UrlValidator.php
yii/validators/UrlValidator.php
+4
-4
ActiveForm.php
yii/widgets/ActiveForm.php
+0
-1
No files found.
yii/validators/BooleanValidator.php
View file @
bf1b2d99
...
...
@@ -102,6 +102,7 @@ class BooleanValidator extends Validator
$options
[
'strict'
]
=
1
;
}
$view
->
registerAssetBundle
(
'yii/form'
);
return
'yii.validation.boolean(value, messages, '
.
json_encode
(
$options
)
.
');'
;
}
}
yii/validators/CaptchaValidator.php
View file @
bf1b2d99
...
...
@@ -113,6 +113,7 @@ class CaptchaValidator extends Validator
$options
[
'skipOnEmpty'
]
=
1
;
}
$view
->
registerAssetBundle
(
'yii/form'
);
return
'yii.validation.captcha(value, messages, '
.
json_encode
(
$options
)
.
');'
;
}
}
...
...
yii/validators/CompareValidator.php
View file @
bf1b2d99
...
...
@@ -205,6 +205,7 @@ class CompareValidator extends Validator
'{compareValue}'
=>
$compareValue
,
)));
$view
->
registerAssetBundle
(
'yii/form'
);
return
'yii.validation.compare(value, messages, '
.
json_encode
(
$options
)
.
');'
;
}
}
yii/validators/EmailValidator.php
View file @
bf1b2d99
...
...
@@ -119,10 +119,6 @@ class EmailValidator extends Validator
*/
public
function
clientValidateAttribute
(
$object
,
$attribute
,
$view
)
{
if
(
$this
->
enableIDN
)
{
$view
->
registerAssetBundle
(
'punycode'
);
}
$options
=
array
(
'pattern'
=>
new
JsExpression
(
$this
->
pattern
),
'fullPattern'
=>
new
JsExpression
(
$this
->
fullPattern
),
...
...
@@ -137,6 +133,10 @@ class EmailValidator extends Validator
$options
[
'skipOnEmpty'
]
=
1
;
}
$view
->
registerAssetBundle
(
'yii/form'
);
if
(
$this
->
enableIDN
)
{
$view
->
registerAssetBundle
(
'punycode'
);
}
return
'yii.validation.email(value, messages, '
.
Json
::
encode
(
$options
)
.
');'
;
}
}
yii/validators/NumberValidator.php
View file @
bf1b2d99
...
...
@@ -151,6 +151,7 @@ class NumberValidator extends Validator
$options
[
'skipOnEmpty'
]
=
1
;
}
$view
->
registerAssetBundle
(
'yii/form'
);
return
'yii.validation.number(value, messages, '
.
Json
::
encode
(
$options
)
.
');'
;
}
}
yii/validators/RangeValidator.php
View file @
bf1b2d99
...
...
@@ -103,6 +103,7 @@ class RangeValidator extends Validator
$options
[
'skipOnEmpty'
]
=
1
;
}
$view
->
registerAssetBundle
(
'yii/form'
);
return
'yii.validation.range(value, messages, '
.
json_encode
(
$options
)
.
');'
;
}
}
yii/validators/RegularExpressionValidator.php
View file @
bf1b2d99
...
...
@@ -112,6 +112,7 @@ class RegularExpressionValidator extends Validator
$options
[
'skipOnEmpty'
]
=
1
;
}
$view
->
registerAssetBundle
(
'yii/form'
);
return
'yii.validation.regularExpression(value, messages, '
.
Json
::
encode
(
$options
)
.
');'
;
}
}
yii/validators/RequiredValidator.php
View file @
bf1b2d99
...
...
@@ -126,6 +126,7 @@ class RequiredValidator extends Validator
'{value}'
=>
$object
->
$attribute
,
)));
$view
->
registerAssetBundle
(
'yii/form'
);
return
'yii.validation.required(value, messages, '
.
json_encode
(
$options
)
.
');'
;
}
}
yii/validators/StringValidator.php
View file @
bf1b2d99
...
...
@@ -170,6 +170,7 @@ class StringValidator extends Validator
$options
[
'skipOnEmpty'
]
=
1
;
}
$view
->
registerAssetBundle
(
'yii/form'
);
return
'yii.validation.string(value, messages, '
.
json_encode
(
$options
)
.
');'
;
}
}
...
...
yii/validators/UrlValidator.php
View file @
bf1b2d99
...
...
@@ -117,10 +117,6 @@ class UrlValidator extends Validator
*/
public
function
clientValidateAttribute
(
$object
,
$attribute
,
$view
)
{
if
(
$this
->
enableIDN
)
{
$view
->
registerAssetBundle
(
'punycode'
);
}
if
(
strpos
(
$this
->
pattern
,
'{schemes}'
)
!==
false
)
{
$pattern
=
str_replace
(
'{schemes}'
,
'('
.
implode
(
'|'
,
$this
->
validSchemes
)
.
')'
,
$this
->
pattern
);
}
else
{
...
...
@@ -142,6 +138,10 @@ class UrlValidator extends Validator
$options
[
'defaultScheme'
]
=
$this
->
defaultScheme
;
}
$view
->
registerAssetBundle
(
'yii/form'
);
if
(
$this
->
enableIDN
)
{
$view
->
registerAssetBundle
(
'punycode'
);
}
return
'yii.validation.url(value, messages, '
.
Json
::
encode
(
$options
)
.
');'
;
}
}
yii/widgets/ActiveForm.php
View file @
bf1b2d99
...
...
@@ -134,7 +134,6 @@ class ActiveForm extends Widget
$id
=
$this
->
options
[
'id'
];
$options
=
Json
::
encode
(
$this
->
getClientOptions
());
$attributes
=
Json
::
encode
(
$this
->
attributes
);
$this
->
view
->
registerAssetBundle
(
'yii/form'
);
$this
->
view
->
registerJs
(
"jQuery('#
$id
').yiiActiveForm(
$attributes
,
$options
);"
);
}
echo
Html
::
endForm
();
...
...
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