Merge branch 'SamMousa-enh-link-submission-form-attribute-9893'

This commit is contained in:
SilverFire - Dmitry Naumenko
2016-02-25 15:48:20 +02:00
2 changed files with 6 additions and 4 deletions

View File

@ -8,6 +8,7 @@ Yii Framework 2 Change Log
- Bug #10850: Fixed unable to use 'definitions' and 'aliases' at `yii\widgets\MaskedInput` (rahimov, klimov-paul)
- Bug #10946: Fixed parameters binding to the SQL query in `yii\db\mysqlSchema::findConstraints()` (silverfire)
- Enh #5469: Add mimetype validation by mask in FileValidator (kirsenn, samdark, silverfire)
- Enh #9893: `yii.js` handleAction enhanced to support for data-form attribute, so links can trigger specific forms (SamMousa)
- 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 #10451: Check of existence of `$_SERVER` in `\yii\web\Request` before using it (quantum13)
- Enh #10610: Added `BaseUrl::$urlManager` to be able to set URL manager used for creating URLs (samdark)

View File

@ -144,8 +144,8 @@ yii = (function ($) {
* @param $e the jQuery representation of the element
*/
handleAction: function ($e, event) {
var method = $e.data('method'),
$form = $e.closest('form'),
var $form = $e.attr('data-form') ? $('#' + $e.attr('data-form')) : $e.closest('form'),
method = !$e.data('method') && $form ? $form.attr('method') : $e.data('method'),
action = $e.attr('href'),
params = $e.data('params'),
pjax = $e.data('pjax'),
@ -345,9 +345,10 @@ yii = (function ($) {
var handler = function (event) {
var $this = $(this),
method = $this.data('method'),
message = $this.data('confirm');
message = $this.data('confirm'),
form = $this.data('form');
if (method === undefined && message === undefined) {
if (method === undefined && message === undefined && form === undefined) {
return true;
}