Editing a submitted Submission sets it back to draft

Created on 21 May 2024, 8 months ago
Updated 6 September 2024, 4 months ago

Problem/Motivation

We have webforms configured:
Allow users to save multiple drafts
Automatically save as draft when paging, previewing, and when there are validation errors
When the user has a form opened into two tabs, submits in one and then saves on the other, sets the submission back to draft.

Steps to reproduce

Enable the following two settings:
Allow users to save multiple drafts
Automatically save as draft when paging, previewing, and when there are validation errors

Create a multipage webform that has a save button that saves draft and a submit.

Create one submission, fill page 1 and click next (the submission is saved as draft)
Duplicate the window or on another tab open the submission for editing.
Go back to your first window and complete and submit the form (in_draft = 0)
Go to your other tab and click save. The submission becomes draft again (in_draft=1)

Proposed resolution

To override we had alter the form and throw errors on submit and on save. We also had to patch webform module to prevent the ::autosave function triggered after the submit.
I understand that the case above is an edge case and for many probably correct behavior of webforms, but it would be nice if there was an option that when enabled would prevent the update of the webform_submissions table whenever the form is completed.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

6.3

Component

Code

Created by

πŸ‡¬πŸ‡·Greece maggie_s

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @maggie_s
  • What is an β€œapplication” as it says in the title? Should that be β€œsubmission”?

  • πŸ‡¬πŸ‡·Greece maggie_s

    @cilefen correct, I updated the title

  • πŸ‡©πŸ‡ͺGermany macdev_drupal Wiesbaden

    We are facing a similar issue. It would be beneficial to have an option to mark a Webform submission as "frozen" once a draft is submitted.

    Currently, we provide an anonymous user with a tokenized URL to allow them to return later and continue editing the draft. However, once the form is finally submitted, the submission should no longer be editable, at least by the anonymous user.

    The problem is that as long as the token URL remains valid, the submission can still be edited, even after it has been marked as submitted. This creates a situation where users can modify what should be a finalized submission.

    Having a way to lock or freeze submissions after they are marked as complete would resolve this issue.

    Maybe this could be achieved with a webform handler? Maybe there already is one?

  • πŸ‡©πŸ‡ͺGermany macdev_drupal Wiesbaden

    Okay, I tried using an action handler: Lock submission when submitted. This is one of the options provided by Webform.

    After pressing the submit button, the submission is successfully locked. However, when the user opens the tokenized URL and re-edits the form, the lock is removed, and the values can be changed.

    I believe this might be a bug. Or is it intended behavior that a locked submission can still be edited?

  • πŸ‡¨πŸ‡¦Canada Liam Morland Ontario, CA πŸ‡¨πŸ‡¦

    What you are talking about sounds like a reasonable use case. It would be good to support it.

Production build 0.71.5 2024