This is a weird problem and I've been trying to find a solution for days now, but no luck so far. I know many users have posted about different kinds of redirecting problems (especially when Webform is used as a block), but my problem is that no matter what settings I use for the redirect (custom URL, no redirect..), my webform always redirects to its own page.

So I'm using the form as a block on a one page site and naturally I'd like it to redirect to the same page. I have done this many times before with Drupal 7 and an older version of Webform, but with 7.x-4.3 I just can't do it. It always redirects to its own page, and error messages (or any other messages) are not shown in the block, although the input fields get the "error" class if validation fails. The form also submits as it's supposed to, so no problem there.

On its own page the form works perfectly with error messages appearing and all, of course.

As I said before, changing the redirecting settings have absolutely no effect. I have no custom module or form related overrides going on. I have built the form from scratch a couple of times, but the end result is always the same. I have Clientside Validation module installed, but the problem was present before it was installed. Selecting "Display all pages inside block" in the block settings page makes no difference either. I have tried deleting all template overrides etc. but no luck.

Basically all I have done is built the form as always and placed it on the site as a block. Right after this the problem appeared.

I am more than happy to give more info on the issue if needed.

Comments

danchadwick’s picture

Status: Active » Closed (cannot reproduce)

I have tested redirect with both a block and regular node page, and it seems to be working. I think you'll have to debug to see why the $form_state['redirect'] that is set in the submit handler for webform_client_form isn't actually redirecting. I'm pretty sure you have some module incompatibility.

If you can reproduce this with a clean installation with just webform installed, please reopen. Or if you figure out something that is wrong in webform, then please post detailed steps to reproduce.

mariusm’s picture

The error occurs if the block is in the front page. Error does not occur if the block is on another page.

Wamp
Fresh install
drupal 7.34
ctools 7.x-1.6
views 7.x-3.10+2-dev
webform 7.x-4.3

danchadwick’s picture

Still works for me if I redirect to

<front>

More detailed instructions, maybe? Something is different.

mariusm’s picture

I do not know but does not work with redirecting "<front>". Redirection does not work for the "<front>"

I only installed modules listed above. I did not do additional settings for drupal.
PHP 5.3.13
MySql 5.5.24

Steps:
- I add a simple webfom with 1 field required
- In form settings

  • Redirection location : No redirect (reload current page) Or Custom URL ( <front>)
  • Advanced settings : Available as block

- In block settings

  • View mode : Form Only
  • Multi-page handling : Display all pages inside block
mariusm’s picture

The error occurs when we have validation errors.
The error does not occur on form submission and validating is OK

danchadwick’s picture

That works for me too.

1. I create a webform with 2 required webform components.
2. I set the redirect page to be none.
3. I enable the option to create the webform block.
4. I configure the webform block to show only on the user/1 page, in the content region.
5. I view the user/1 page and see the webform.
6. I try to submit it without filling in the required components, and I stay on the user/1 page with validation errors shown.
7. I fill in the required components and submit the form. I stay on user/1 with a new blank form shown in the block.

Working perfectly for me using the latest 7.x-4.x, although I don't think 7.x-4.3 is any different with regard to redirect. I think something is different about your installation, custom code, theme, other modules. Or you need to provide extremely detailed, tiny baby steps, to reproduce this, starting with enabling webform. Make sure you are using no other webform-related modules which could be causing this. Be sure to re-open the issue status, too.

mariusm’s picture

Please configure webform block to show on<front>..
The problem occurs only on the home page of the site.

danchadwick’s picture

Status: Closed (cannot reproduce) » Closed (works as designed)

OK. This is weird. I typed a reply to this a few days ago, but I see it's not here. I must have been distracted by a squirrel and not clicked Submit.

I bet that the webform node is being displayed nodes listed on the front page, in addition to the block. When I configure the webform to be promoted to front, then I get the behavior you describe because you are there are two webforms and you are effectively replying to both.

If I mark the webform not as NOT "Promote to front" then I get the correct behavior I described in #6.

Please re-open if you are sure this isn't your situation, with more detailed instructions.