From ca35bb05a8661bffcd6f574e55c6a35826dfa757 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Tue, 6 Aug 2013 16:02:14 -0400 Subject: [PATCH] replaced attr with prop. --- framework/yii/assets/yii.activeForm.js | 12 ++++++------ framework/yii/widgets/ActiveForm.php | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/framework/yii/assets/yii.activeForm.js b/framework/yii/assets/yii.activeForm.js index 2b08d53..17ea8a7 100644 --- a/framework/yii/assets/yii.activeForm.js +++ b/framework/yii/assets/yii.activeForm.js @@ -83,7 +83,7 @@ var settings = $.extend({}, defaults, options || {}); if (settings.validationUrl === undefined) { - settings.validationUrl = $form.attr('action'); + settings.validationUrl = $form.prop('action'); } $.each(attributes, function (i) { attributes[i] = $.extend({value: getValue($form, this)}, attributeDefaults, this); @@ -291,13 +291,13 @@ // If the validation is triggered by form submission, ajax validation // should be done only when all inputs pass client validation var $button = data.submitObject, - extData = '&' + data.settings.ajaxVar + '=' + $form.attr('id'); - if ($button && $button.length && $button.attr('name')) { - extData += '&' + $button.attr('name') + '=' + $button.attr('value'); + extData = '&' + data.settings.ajaxVar + '=' + $form.prop('id'); + if ($button && $button.length && $button.prop('name')) { + extData += '&' + $button.prop('name') + '=' + $button.prop('value'); } $.ajax({ url: data.settings.validationUrl, - type: $form.attr('method'), + type: $form.prop('method'), data: $form.serialize() + extData, dataType: 'json', success: function (msgs) { @@ -380,7 +380,7 @@ var getValue = function ($form, attribute) { var $input = findInput($form, attribute); - var type = $input.attr('type'); + var type = $input.prop('type'); if (type === 'checkbox' || type === 'radio') { return $input.filter(':checked').val(); } else { diff --git a/framework/yii/widgets/ActiveForm.php b/framework/yii/widgets/ActiveForm.php index 1d4be89..fa04eb9 100644 --- a/framework/yii/widgets/ActiveForm.php +++ b/framework/yii/widgets/ActiveForm.php @@ -152,7 +152,7 @@ class ActiveForm extends Widget $this->options['id'] = $this->getId(); } if (!isset($this->fieldConfig['class'])) { - $this->fieldConfig['class'] = 'yii\widgets\ActiveField'; + $this->fieldConfig['class'] = ActiveField::className(); } echo Html::beginForm($this->action, $this->method, $this->options); }