Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-38555

Forms do not prevent same data submission multiple times.

    Details

    • Testing Instructions:
      Hide
      1. Open forum, select "Add a new topic" or "Reply" to existing one.
      2. Fill-in required fields.
      3. Try to click on Submit as many times as you can (do a double-click at least).
      4. Observe that after the first click the button becomes disabled and just one post appear as a result of submission.

      Testing fields error case:

      1. Open forum, select "Add a new topic" or "Reply" to existing one.
      2. Leave one of required fields empty.
      3. Submit the form and ensure that submit button does not become disabled.
      Show
      Open forum, select "Add a new topic" or "Reply" to existing one. Fill-in required fields. Try to click on Submit as many times as you can (do a double-click at least). Observe that after the first click the button becomes disabled and just one post appear as a result of submission. Testing fields error case: Open forum, select "Add a new topic" or "Reply" to existing one. Leave one of required fields empty. Submit the form and ensure that submit button does not become disabled.
    • Affected Branches:
      MOODLE_24_STABLE, MOODLE_28_STABLE
    • Pull Master Branch:
      MDL-38555-master

      Description

      Users reported that the forum post they submit appear twice or more times in some cases. Deeper investigation revealed that this happen if user double-clicks submit button or press submit again before the page has re-loaded after initial submission.

      It is easy to replicate:

      • Open forum, select "Add a new topic" or "Reply" to existing one
      • Fill-in required fields
      • Try to click on Submit as many times as you can (do a double-click at least).
      • Observe the result of submission, you should see the copy of your post published several times.

      The suggested solution disables submit button after the first click preventing multiple submissions, but it is slightly hacky as button should not be disabled if the from contains validation errors and JS validation code is output inline using getValidationScript() method. Better ideas are welcome.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  3 Vote for this issue
                  Watchers:
                  13 Start watching this issue

                  Dates

                  • Created:
                    Updated: