Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi everyone,
i'm stuck on a bug with the latest webform dev.
I have a single page webform with preview page. Whenever i click the back button on the preview page, the form submit and move forward to the confirmation page.
I think this maybe related to the lines 2922 to 2924
// The "Previous" button over-shoots backwards by one page. The "Next"
// button doesn't advance at all, so in both cases, we increment by one.
$form_state['storage']['page_num']++;
does anyone else have this bug ?
Comment | File | Size | Author |
---|---|---|---|
#3 | webform-previous_button_fix-2204515-3.patch | 1.14 KB | SpadXIII |
#2 | webform-previous_button_fix-2204515-2.patch | 1.54 KB | tempo22 |
Comments
Comment #1
quicksketchHi @tempo22, thanks for opening this issue. I thought I saw another user reporting this same problem, but I can't find it at first pass through the issue queue.
I've confirmed this problem on a stock install of Webform, but the problem only appears when there is only one page in the form. On multi-page forms, the preview back button works correctly. I've got a lot of things going on currently, but I'll try to address this when I get the chance. Anyone else interested in attempting a patch, please do so.
Comment #2
tempo22 CreditAttribution: tempo22 commentedThis fixed it for me. However the code seem a bit messy and maybe worth to check why the preview page back button overshot.
Comment #3
SpadXIII CreditAttribution: SpadXIII commentedHere's a different kind of patch that is a bit smaller.
It adds a check if a previous pagebreak has been found.
Comment #4
quicksketchThanks guys! Between the two patches, @SpadXIII's would be preferable for me from a maintenance stand-point. @tempo22, could you test it out and see if it works in the situations you're trying?
Comment #5
tempo22 CreditAttribution: tempo22 commentedWork for me :)
Comment #6
SpadXIII CreditAttribution: SpadXIII commentedMy patch probably needs a bit of testing still; a co-worker had found a little issue but I haven't had time to check it myself
Comment #7
SpadXIII CreditAttribution: SpadXIII commentedThe issue that I mentioned is not really related to this; if the last component is a page-break, you can't continue anymore. You're stuck in the page before the 'empty page'. I think this is related to the code in the .module around line 2896; the foreach-loop exits after the found page-break, but doesn't move to the next page. I guess it's better to make a new issue of this?
Comment #8
quicksketchLooks like DanChadwick made an issue for this exact issue at #2220679: Cannot submit if the webform ends in a page break. You guys work together? :)
Comment #9
quicksketchThis patch works great. Committed to the 4.x branch. Thanks guys!
Comment #12
fenstratNeeds porting to 8.x-4.x.
Comment #13
fenstratCommitted and pushed 09b8973 to 8.x-4.x. Thanks!
Comment #16
bushrang3r CreditAttribution: bushrang3r commentedHi everyone,
Sorry to open this again but I'm still having this same or very similar issue.
I have a multi-page form and when I click the back button to preview the previous page, the previous page appears but the form is submitted. If I go through each page of the form, fill in the information and click back on each page, it gets submitted every time so the one form has 2, 3, 4 submissions even before getting to the submit button on the last page.
I thought maybe I should install the dev version but the 7.x.4.1 was updated more recently than the dev.
Comment #17
bushrang3r CreditAttribution: bushrang3r commentedSorry folks. I was using the module incorrectly.
I tried to return this issue back to it's previous status.