Browse Source

Added support of :submit[formtarget]

tags/2.0.8
AnatolyRugalev 9 years ago committed by SilverFire - Dmitry Naumenko
parent
commit
59fdac54ff
  1. 2
      framework/CHANGELOG.md
  2. 10
      framework/assets/yii.activeForm.js

2
framework/CHANGELOG.md

@ -51,6 +51,7 @@ Yii Framework 2 Change Log
- Enh #9562: Adds `char` datatype to framework (df2)
- Enh #9604: `yii\db\BaseActiveRecord` now triggers event `EVENT_AFTER_REFRESH` after a record is refreshed (raoul2000)
- Enh #9893: `yii.js` handleAction enhanced to support for data-form attribute, so links can trigger specific forms (SamMousa)
- Enh #10322: ActiveForm now respects formtarget attribute of submit button (AnatolyRugalev)
- Enh #10451: Check of existence of `$_SERVER` in `\yii\web\Request` before using it (quantum13)
- Enh #10487: `yii\helpers\BaseArrayHelper::index()` got a third parameter `$groupBy` to group the input array by the key in one or more dimensions (quantum13, silverfire, samdark)
- Enh #10610: Added `BaseUrl::$urlManager` to be able to set URL manager used for creating URLs (samdark)
@ -211,6 +212,7 @@ Yii Framework 2 Change Log
- Enh #10783: Added migration and unit-tests for `yii\i18n\DbMessageSource` (silverfire)
- Enh #10797: Cleaned up requirements checker CSS (muhammadcahya)
- Enh #11336: Allow resettting `$hostInfo`, `$scriptUrl`, and `$pathInfo` in `yii\web\Request` and `$baseUrl`, and `$hostInfo` in `yii\web\UrlManager` to `null`, to make Yii determine the value again (cebe)
- Enh #10322: `yii.activeForm.js` now respects the `formtarget` attribute of submit button (anatolyrugalev)
- Enh: Added last resort measure for `FileHelper::removeDirectory()` fail to unlink symlinks under Windows (samdark)
- Enh: `AttributeBehavior::getValue()` now respects the callable in array format (silverfire)
- Chg #6419: Added `yii\web\ErrorHandler::displayVars` make list of displayed vars customizable. `$_ENV` and `$_SERVER` are not displayed by default anymore (silverfire)

10
framework/assets/yii.activeForm.js

@ -201,7 +201,8 @@
settings: settings,
attributes: attributes,
submitting: false,
validated: false
validated: false,
target: $form.attr('target')
});
/**
@ -575,7 +576,14 @@
data.submitting = false;
} else {
data.validated = true;
var buttonTarget = data.submitObject ? data.submitObject.attr('formtarget') : null;
if (buttonTarget) {
// set target attribute to form tag before submit
$form.attr('target', buttonTarget);
}
$form.submit();
// restore original target attribute value
$form.attr('target', data.target);
}
} else {
$.each(data.attributes, function () {

Loading…
Cancel
Save