Skip to content

Commit

Permalink
* Added support of :submit[formtarget]
Browse files Browse the repository at this point in the history
* Added support of :submit[formtarget]
  • Loading branch information
AnatolyRugalev authored and SilverFire committed Apr 21, 2016
1 parent 9c1fa3f commit d3fb217
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Yii Framework 2 Change Log
- Enh #9340: Adds `after()` and `first()` column schema builder modifiers (df2)
- Enh #9562: Adds `char` datatype to framework (df2)
- 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)
Expand Down
9 changes: 8 additions & 1 deletion framework/assets/yii.activeForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@
settings: settings,
attributes: attributes,
submitting: false,
validated: false
validated: false,
target: $form.attr('target')
});

/**
Expand Down Expand Up @@ -575,7 +576,13 @@
data.submitting = false;
} else {
data.validated = true;
var buttonTarget = $button.attr('formtarget');
if (data.submitObject && buttonTarget) {
// set target attribute to form tag at submit moment
$form.attr('target', buttonTarget);
}
$form.submit();
$form.attr('target', data.target);
}
} else {
$.each(data.attributes, function () {
Expand Down

0 comments on commit d3fb217

Please sign in to comment.