mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-17 14:57:23 +08:00
Form asset bundle registering code moved from ActiveForm::run() to the *Validator::clientValidateAttribute().
This commit is contained in:
@@ -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) . ');';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user