Hi there,

I'm using Webform which has been a god send so far. I am having one problem though. I have the form setup to start in a block for preliminary information which then progresses to a multi page (page based) webform which asks for much more information on page 2, 3 and 4. Now while the block part works and switches to a page based page 2 (hope that makes sense) when the drafts option is switched off, when the save to drafts option is switched on, the form stays in block form when it moves to pages 2, 3 and 4 where pagebreaks are inserted and as such the form stays in the sidebar or region that the block is designated to.

The reason I need the drafts option switched on is so that I can access submitted information from previous pages on subsequent pages.

I have checked the option 'Show all webform pages in block' in the block configuration and it is switched off so that shouldn't be the problem. Any help would be greatly appreciated.

Files: 
CommentFileSizeAuthor
#4 webform_block_draft_redirect.patch579 bytesquicksketch

Comments

Thanks for your extensive description of the problem @stuhannaford. This sounds like it also may be the problem for #1497084: Form action is set to same page with multistep form when logged in.. I'll see if I can reproduce the problem.

I've been able to reproduce this problem on my local, but there's one more step:

The FIRST time you start to fill out a form as a logged in user, it DOES redirect just fine. It's only after you have started to fill out a submission (but not finished it) and then visit the page again that the redirect does not work properly. If you complete the submission and start over, the redirect works again.

The problem is this bit of code:

  if ($pages_in_node && empty($submission)) {
    $query = $_GET;
    unset($query['q']);
    $form['#action'] = url('node/' . $node->nid, array('query' => $query));
  }

We only set the #action if the $submission is empty. But in the event that the user is resuming a draft, the $submission variable is already set. It looks to me like that check can be entirely removed.

Thanks. I'll comment out that code and see if it fixes it. Which function is that in?

Status:Active» Needs review
StatusFileSize
new579 bytes

It's in webform_client_form() in webform.module. This patch should also correct the problem.

That $submission check was added before we added the block-specific code. I'll try to dig up what it's supposed to be doing.

Looks like the $submission check was legacy code left over after #1033090: Multiple step form - first in block the rest in node was committed. I can't see any reason to keep the check in there.

Yup getting rid of the empty($submission) check fixed it.

Thanks!

Status:Needs review» Fixed

Excellent, thanks for checking. I've committed this patch to both 3.x branches and it will be in the next version of Webform.

You may also be interested in #250767: #action breaks webform inside another node, where we're solving a similar problem with the display of multi-page forms in places other than blocks (such as in a panel).

Status:Fixed» Closed (fixed)

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