Closed (won't fix)
Project:
Webform
Version:
8.x-5.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
26 May 2019 at 02:38 UTC
Updated:
3 Oct 2020 at 16:02 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
jrockowitz commentedThe attached patch still needs test coverage around any form rebuilds with ?destination.
Comment #3
jrockowitz commentedSlightly better approach
Comment #4
jrockowitz commentedThe attached patch removes the isAjax check which is not needed.
Comment #5
bwong commentedWorks great. Nice refinement.
Comment #6
jrockowitz commentedComment #8
jrockowitz commentedComment #9
jrockowitz commentedThis patch is causing an unexpected regression where when updating a multi-step form with a ?destination clicking back or next is redirecting to the destination.
Comment #11
jrockowitz commentedFor now, I am reverting the patch. I will try to fix the issue with saving drafts with breaking back/next handling.
Comment #12
jrockowitz commentedRight now the current behavior is when the form is saved the ?destination is used otherwise the form is rebuilt with a message when a draft is saved. I think this is the right behavior.
Comment #13
bwong commentedI think this patch will work. It does not do the rebuild only if the ::save value is in the #submit entry of the triggering element. It works even if you have multiple save buttons. It works normally if the next/previous buttons in a multipage webform.
This patch is the same at 3057138-4.patch with the additional condition.
Comment #14
jrockowitz commentedComment #15
bwong commentedI need this feature to handle the workflow where forms are partially filled in and then saved.
I understand that the default mode of operation does not work this way so this patch adds a setting to explicit enable the feature. The default is to operate as it does now but if you check the new Enable ?destination= with Save button option in the Webform Form Behaviors/Navigation settings then it honors the ?destination= argument. The global setting is included as well.
I did not include changes to the settings for all the unit tests as the default flag value is false so they appear to run as is. It is just a matter of adding:
form_submit_save_destination: false
after form_unsaved to all the .yml files. This should have its own unit test but I am still not getting my unit tests to work properly.
Comment #17
jrockowitz commented@bwong I find this feature a little confusing and addressing a very specific edge case. My recommendation is that you create a very simple work-around patch, post it here, and see if other people want this feature.
Comment #18
bwong commentedHere is the scenario. I am surprised it is not more common but if most people always finalize a form then I can see why it would be less common.
The application is for a science fair where the students need to fill in an application. This can be done in the fall through the spring. The application includes dates and fields that should only be filled in when the application is complete. Normally they can start the application process in the fall by providing details like the project title and their contact information that they then save. They may add more information over time before the application is finally submitted.
All applications are listed when they log in (a user can have more than on application started, often a teacher starts the applications for each student). They can then click on the link to edit the webform submission/application. This link is where the ?destination= argument is used. Clicking Save on the application form brings them back to the list of applications. There are other places where this is used but essentially that Save button is supposed to close the form and bring the user back to the page where they started. In our initial tests the users were confused when the Save button simply left them in the form since they had to navigate back to where they started using menu items.
I think this patch (#18) fixes the failing tests. It includes the default_form_submit_save_destination setting initialization in the config/install/webform.settings.yml configuration file.
I can see where this mode of operation with the Save button would not be something desirable in a multistep form where the user simply wants to make sure the information entered thus far is retained even if the browser tab is closed or they navigate away from the webform. The patch allows the feature to be enabled on a per webform basis. The default settings are to operate as if the feature was not installed so it should not affect existing installations unless they modify the webform settings.
I would have done this as a separate module but there are no rebuild hooks that I could access and it seems like a useful option to have in general.
Comment #19
jrockowitz commentedI think the best immediate solution is to use the below custom code to remove the
::rebuildcallback when a draft is saved with a destination specified.Comment #20
bwong commentedSorry for the late response. This works great and it does not disrupt a multiple page wizard flow. It would be handy to toggle in settings. I'll have to see about doing that in my module.