When editing a submission no action should be triggered.

Currently at least the redirect after submission save is getting triggered in case of a multistep form.
The check in webform.module @1947 seems to be wrong: There's no submission key in the following page submissions.

A fix will follow soon.

Comments

miro_dietiker’s picture

Status: Active » Needs review
StatusFileSize
new705 bytes

Attached patch corrects the issue. I think it doesn't have any side effect.

miro_dietiker’s picture

Title: Don't execute actions on submission edit-save » Don't redirect on submission update
Component: User interface » Code

switching fields now that we have found the problem..

kars-t’s picture

Status: Needs review » Needs work

[edit]
No I miss read the patch it seems nice!

kars-t’s picture

I did talk to miro on the IRC about this.

I can confirm that "$form_state['values']['submission']" is not set on submit. Neither for creation nor edit. But I can't confirm that there is a faulty redirect on edit submission either. So sadly "needs work" seems to be currently correct for this issue.

miro_dietiker’s picture

Status: Needs work » Needs review

I've redone the test.
Create a form, add 2 components, add a page break in between.
Add an internal path as redirect target - e.g. "node".
After a submission, redirect happens. Also on submission edit redirect happens here. This is fixed with the patch above.

So i can't reproducewhy it works as expected on your side, Kars-T.

kars-t’s picture

Status: Needs review » Reviewed & tested by the community

Okay after an hour of test I figured it out:

If you edit from "node/1/webform-results" you get links in the form of "node/1/submission/1/edit?destination=node%2F1%2Fwebform-results". Of course this will work.

But miro did use the link from the "view" of the result. And that does NOT have a destination! So the redirect will be executed. I than used his patch and you will stay on the result.

quicksketch’s picture

This sounds like the same as #216627: Redirect after editing submission, can I mark that one duplicate (since this one has a patch)?

miro_dietiker’s picture

quicksketch, not really.
the action to finally confirm the editing (and staying on the edit form) was broken due to a wrong check. on editing it is/was finally redirected to the submission target without this patch. that's what we fix.

the other issue suggests changing the behaviour to add another redirect on edit to the target of viewing the submission.
i fully agree this would be a nice solution. but this is instead of fixing the condition, it needs additionally switching the redirect like:

- $redirect = NULL;
+ $redirect = 'node/'.$NODE_ID.'/submission/'.$SUBMISSION_ID;

(you need to update the variable names to be correct.)

in other words:
i'm telling you the detection of the edit case doesn't work anymore in 3.x-dev.
he's telling you that we should change the behaviour in right that case.

quicksketch’s picture

Status: Reviewed & tested by the community » Fixed
StatusFileSize
new615 bytes

Thanks this worked perfectly for me. I shortened up the conditional by using !empty($value), which is the same as isset($value) && $value. Committed to both 3.x branches.

Status: Fixed » Closed (fixed)

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