Project

General

Profile

Actions

Defect #10675

closed

"Submit and continue" is broken

Added by Etienne Massip about 12 years ago. Updated almost 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Issues
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

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


Related issues

Related to Redmine - Feature #6555: Double-click on "Submit" and "Save" buttons should not send two requests to serverClosedJean-Philippe Lang2010-10-01

Actions
Actions #1

Updated by Etienne Massip about 12 years ago

  • Affected version (unused) set to 1.4.0
  • Affected version set to 1.4.0
Actions #2

Updated by Etienne Massip about 12 years ago

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.

Actions #3

Updated by Etienne Massip about 12 years ago

Guess it's due to r9391 for #6555 wich disables input[type=submit].

Actions #4

Updated by Etienne Massip about 12 years ago

Following replacement might be overkill but works on Chrome & IE8:

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);
    });
  });
}
Actions #5

Updated by Etienne Massip about 12 years ago

Shorter, not tested:

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);
    });
  });
}

Actions #6

Updated by Jean-Philippe Lang about 12 years ago

  • Target version changed from Candidate for next minor release to 1.4.1
Actions #7

Updated by Etienne Massip about 12 years ago

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

Actions #8

Updated by Jean-Philippe Lang about 12 years ago

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.

Actions #9

Updated by Etienne Massip about 12 years ago

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?

Actions #10

Updated by Jean-Philippe Lang about 12 years ago

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:

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);
      });
    }
  });
}
Actions #11

Updated by Etienne Massip about 12 years ago

Think you've got the best answer.

Actions #12

Updated by Jean-Philippe Lang almost 12 years ago

  • Status changed from Confirmed to Closed
  • Resolution set to Fixed

Fix committed, thanks.

Actions

Also available in: Atom PDF