Browse Source

Fixes #6642: Fixed the bug that using confirmation dialog via `data-confirm` in an `ActiveForm` may cause the dialog to appear twice

tags/2.0.4
Qiang Xue 10 years ago
parent
commit
3abc07d16c
  1. 1
      framework/CHANGELOG.md
  2. 18
      framework/assets/yii.activeForm.js

1
framework/CHANGELOG.md

@ -4,6 +4,7 @@ Yii Framework 2 Change Log
2.0.4 under development
-----------------------
- Bug #6642: Fixed the bug that using confirmation dialog via `data-confirm` in an `ActiveForm` may cause the dialog to appear twice (pana1990, qiangxue)
- Bug #6871: Fixed the bug that using defaults and hostnames in URL rules may cause an out-of-range index issue (qiangxue)
- Bug #7529: Fixed `yii\web\Response::sendContentAsFile()` that was broken in 2.0.3 (samdark)
- Bug #7603: Fixed escape characters in `FormatConverter` to work with unicode characters (maddoger, cebe)

18
framework/assets/yii.activeForm.js

@ -509,12 +509,20 @@
data.validated = true;
var $button = data.submitObject || $form.find(':submit:first');
// TODO: if the submission is caused by "change" event, it will not work
if ($button.length) {
$button.click();
} else {
// no submit button in the form
$form.submit();
if ($button.length && $button.prop('type') == 'submit' && $button.prop('name')) {
// simulate button input value
var $hiddenButton = $('input[type="hidden"][name="' + $button.prop('name') + '"]', $form);
if (!$hiddenButton.length) {
$('<input>').attr({
type: 'hidden',
name: $button.prop('name'),
value: $button.prop('value')
}).appendTo($form);
} else {
$hiddenButton.prop('value', $button.prop('value'));
}
}
$form.submit();
}
} else {
$.each(data.attributes, function () {

Loading…
Cancel
Save