Commit 7d999b26 by Qiang Xue

form fix.

parent 86330471
......@@ -360,7 +360,7 @@
attribute.status = 1;
if ($input.length) {
hasError = messages && $.isArray(messages[attribute.id]) && messages[attribute.name].length;
hasError = messages && $.isArray(messages[attribute.name]) && messages[attribute.name].length;
var $container = $form.find(attribute.container);
$container.removeClass(
data.settings.validatingCssClass + ' ' +
......@@ -369,7 +369,7 @@
);
if (hasError) {
$form.find(attribute.error).html(messages[attribute.name][0]);
$container.find(attribute.error).html(messages[attribute.name][0]);
$container.addClass(data.settings.errorCssClass);
} else if (attribute.enableAjaxValidation || attribute.enableClientValidation && attribute.validate) {
$container.addClass(data.settings.successCssClass);
......
......@@ -65,7 +65,7 @@ class ActiveField extends Component
$attribute = Html::getAttributeName($this->attribute);
$validators = array();
foreach ($this->model->getValidators($attribute) as $validator) {
foreach ($this->model->getActiveValidators($attribute) as $validator) {
/** @var \yii\validators\Validator $validator */
if (($js = $validator->clientValidateAttribute($this->model, $attribute)) != '') {
$validators[] = $js;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment