プロジェクト

全般

プロフィール

Vote #71652

完了

"Submit and continue" is broken

Admin Redmine さんが約2年前に追加. 約2年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Issues_2
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
2
version_id:
46
issue_org_id:
10675
author_id:
6508
assigned_to_id:
0
comments:
12
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
40
ステータス-->[Closed]

説明

"Submit and continue" button behaves just as "Submit" at issue creation.


journals

--------------------------------------------------------------------------------
Reproduced with FF & Chrome, works fine on www.redmine.org but not on http://xxx.m.redmine.org.

According to my log, worked fine on r9381.

Since then, looks like submit control name is no more in @POST@ form data.

--------------------------------------------------------------------------------
Guess it's due to r9391 for #6555 wich disables @input[type=submit]@.
--------------------------------------------------------------------------------
Following replacement might be overkill but works on Chrome & IE8:

<pre><code class="javascript">
function addFormObserversForDoubleSubmit() {
$$('form[method=post]').each(function(form) {
form.on('submit', function(form_submission) {
alreadySubmitted = (form.getStorage().get('submitting') == true);
if(alreadySubmitted)
form_submission.stop();
else
form.getStorage().set('submitting', true);
});
});
}
</code></pre>
--------------------------------------------------------------------------------
Shorter, not tested:
<pre><code class="javascript">
function addFormObserversForDoubleSubmit() {
$$('form[method=post]').each(function(form) {
form.on('submit', function(form_submission) {
if(form.getStorage().get('submitted'))
form_submission.stop();
else
form.getStorage().set('submitted', true);
});
});
}
</code></pre>
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Note: of course the above code will break any form in the application which should be allowed to be submitted more than once.
--------------------------------------------------------------------------------
The shorter patch works fine for with FF11, latest Chrome and IE6/9 as well. Please commit.

Etienne Massip wrote:
> Note: of course the above code will break any form in the application which should be allowed to be submitted more than once.

So did r9391. We can add a special class on forms that need to be submitted more than once.
--------------------------------------------------------------------------------
Jean-Philippe Lang wrote:
> So did r9391. We can add a special class on forms that need to be submitted more than once.

Are there such forms? I was thinking of some Rails dark magic reloading only a part of the form DOM via XHR on form submission, but I don't know if it exists?
--------------------------------------------------------------------------------
I don't think there is any of these forms in the core but it might be desirable, just in case a plugin needs it. Something like:

<pre><code class="javascript">
function addFormObserversForDoubleSubmit() {
$$('form[method=post]').each(function(form) {
if (!form.hasClassName('multiple-submit')) {
form.on('submit', function(form_submission) {
if(form.getStorage().get('submitted'))
form_submission.stop();
else
form.getStorage().set('submitted', true);
});
}
});
}
</code></pre>

--------------------------------------------------------------------------------
Think you've got the best answer.
--------------------------------------------------------------------------------
Fix committed, thanks.
--------------------------------------------------------------------------------


related_issues

relates,Closed,6555,Double-click on "Submit" and "Save" buttons should not send two requests to server

Admin Redmine さんが約2年前に更新

  • カテゴリIssues_2 にセット
  • 対象バージョン1.4.1_46 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0