Form asset bundle registering code moved from ActiveForm::run() to the *Validator::clientValidateAttribute().

This commit is contained in:
resurtm
2013-05-15 23:33:55 +06:00
parent f7b8595f76
commit bf1b2d9956
11 changed files with 16 additions and 9 deletions

View File

@@ -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) . ');';
}
}