Defect #10675

"Submit and continue" is broken

Added by Etienne Massip over 5 years ago. Updated over 5 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Issues
Target version:1.4.1
Resolution:Fixed Affected version:1.4.0

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 se... Closed 2010-10-01

Associated revisions

Revision 9442
Added by Jean-Philippe Lang over 5 years ago

Fixed that "Create and continue" buttons are broken by r9391 (#10675).

History

#1 Updated by Etienne Massip over 5 years ago

  • Affected version (unused) set to 1.4.0
  • Affected version set to 1.4.0

#2 Updated by Etienne Massip over 5 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.

#3 Updated by Etienne Massip over 5 years ago

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

#4 Updated by Etienne Massip over 5 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);
    });
  });
}

#5 Updated by Etienne Massip over 5 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);
    });
  });
}

#6 Updated by Jean-Philippe Lang over 5 years ago

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

#7 Updated by Etienne Massip over 5 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.

#8 Updated by Jean-Philippe Lang over 5 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.

#9 Updated by Etienne Massip over 5 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?

#10 Updated by Jean-Philippe Lang over 5 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);
      });
    }
  });
}

#11 Updated by Etienne Massip over 5 years ago

Think you've got the best answer.

#12 Updated by Jean-Philippe Lang over 5 years ago

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

Fix committed, thanks.

Also available in: Atom PDF