From f1812210a85b34cf8d30eb7f21be5dc01c356618 Mon Sep 17 00:00:00 2001 From: Qiang Xue <qiang.xue@gmail.com> Date: Fri, 7 Nov 2014 10:29:04 -0500 Subject: [PATCH] Fixes #5768: When setting `data-confirm` attribute to a submit button, clicking on the button would not trigger form submission --- framework/CHANGELOG.md | 1 + framework/assets/yii.js | 2 ++ framework/log/Target.php | 1 - 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 28f9e03..c9897e2 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -16,6 +16,7 @@ Yii Framework 2 Change Log - Bug #5682: The `asset` command would incorrectly combine CSS files when `UrlManager::linkAssets` is true (dmvslv) - Bug #5702: Parenthesis should be automatically added to `Validator::whenClient` to avoid js error (mdmunir, qiangxue) - Bug #5745: Gii and debug modules may cause 404 exception when the route contains dashes (qiangxue) +- Bug #5768: When setting `data-confirm` attribute to a submit button, clicking on the button would not trigger form submission (qiangxue) - Bug #5780: `QueryBuilder::batchInsert()` may cause "undefined index" error (qiangxue) - Bug #5833: The `message` command fails with a FK constraint error when trying to update messages (qiangxue) - Bug #5893: `yii\helpers\ArrayHelper::toArray()` now applies `$properties` parameter for converting descending objects in recursive calls (otsec) diff --git a/framework/assets/yii.js b/framework/assets/yii.js index 3b5b7a0..29458d2 100644 --- a/framework/assets/yii.js +++ b/framework/assets/yii.js @@ -131,6 +131,8 @@ yii = (function ($) { if (method === undefined) { if (action && action != '#') { window.location = action; + } else if ($e.filter(':submit') && $form.length) { + $form.trigger('submit'); } return; } diff --git a/framework/log/Target.php b/framework/log/Target.php index c89138b..d05bdbf 100644 --- a/framework/log/Target.php +++ b/framework/log/Target.php @@ -270,7 +270,6 @@ abstract class Target extends Component $ip = $request instanceof Request ? $request->getUserIP() : '-'; /* @var $user \yii\web\User */ - $user = Yii::$app->has('user', true) ? Yii::$app->get('user') : null; if ($user && ($identity = $user->getIdentity(false))) { $userID = $identity->getId(); -- libgit2 0.27.1