Problem/Motivation

Currently if a user tries to submit while a file is uploading they see a prompt "File upload in progress. Uploaded file may be lost. Do you want to continue?". It does not always make sense to allow a user to submit a form even though a file upload is in progress.

Steps to reproduce

  1. Create a webform with a file upload field.
  2. Navigate to the form
  3. Start uploading a large file. If you're testing this locally you may need to throttle the upload speed to delay the upload enough to see the prompt.
  4. Attempt to submit while the file is still uploading
  5. You should see the prompt. Confirm that you want to submit anyway.
  6. You will either see an error due to the missing file or see a successful form submission but notice the file is missing if you navigate to the submission

Proposed resolution

Provide an option to change this behaviour so that instead of allowing the user to submit the form mid file upload they see an alert and are unable to submit.

Remaining tasks

I will attach a patch shortly.

User interface changes

There will be a new option at /admin/structure/webform/config/elements.

Data model changes

There will be a new option in the webform.settings default config file and schema.

Issue fork webform-3385380

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Dylan Donkersgoed created an issue. See original summary.

dylan donkersgoed’s picture

Status: Active » Needs review
StatusFileSize
new5.35 KB

Patch attached.

jrockowitz’s picture

StatusFileSize
new880 bytes

Right now, I am not adding any new features to the Webform module.

People can use the above patch AS-IS.

I would be open to committing an API change that allows people to override the blockSubmit function. See attached.

bebalachandra’s picture

StatusFileSize
new424.58 KB

As @jrockowitz mentioned there is no feature implementation for now, I have skipped MR!356 from testing (however MR failed test cases).

Tested patch #4. followed all the steps which are given in "Steps to reproduce".

After overriding blockSubmit function the behaviour is same as before while uploading file and submitting. If and only we want blockSubmit function to be overridden then we can use patch #4. else we can use the module AS-IS.

Attached screenshot for reference.

jrockowitz’s picture

Status: Needs review » Postponed (maintainer needs more info)

I want to commit #4's patch AS-IS.

Someone can create a recipe for changing the upload behavior.

  • jrockowitz authored 85d0bc69 on 6.1.x
    Issue #3385380 by Dylan Donkersgoed, jrockowitz: Provide option to...

  • jrockowitz authored 85d0bc69 on 6.x
    Issue #3385380 by Dylan Donkersgoed, jrockowitz: Provide option to...

  • jrockowitz authored 85d0bc69 on 6.2.x
    Issue #3385380 by Dylan Donkersgoed, jrockowitz: Provide option to...
jrockowitz’s picture

Status: Postponed (maintainer needs more info) » Fixed

I committed #4

jrockowitz’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

willempje2’s picture

Not sure if i need to create a new issue for this but my guess would be that "blockSubmit($form)" on line 53 should be changed as well.

https://git.drupalcode.org/project/webform/-/blame/6.2.x/js/webform.elem...