On my site webforms have redirects, that configured via Redirection location: Custom URL in Form settings.
They are works normally on separate page.

But if I open forms via colorbox_node, redirects don't work: after submit instead of showing redirected page, window is closed. Also functions, that starts in redirect page dosn't start too, so redirected page isn't loaded.
How can I fix this problem?
If redirect into colorbox window will not work, can I do redirects to separated page without colorbox?

CommentFileSizeAuthor
#8 WebformRedirect-1735390-8.patch1.17 KBiLLin

Comments

iLLin’s picture

What browser? This worked for me when I set it up.

murz’s picture

Browser is Mozilla Firefox 14, you can try to reproduce this issue here:
http://caramba-nn.ru/product/magic-ball
Press on the link "Подписаться на снижение цены" in right column, type in "E-mail или телефон" field something like "test@example.com", and you will see that colorbox window closed.
If you use full form page: http://caramba-nn.ru/node/27?width=500&nid=33 and submit form, you will go to the http://caramba-nn.ru/order-submit?sid=XXX page via 301 redirect.
Can you help to understand, why in my site redirect is not working?

murz’s picture

Now I also test this on another developing site and it isn't work too. After clicking submit colorbox closes and I stay on current page, redirect is missed. Did you have any example site on which I can see how this works and try to find differences on my site?

iLLin’s picture

Can you add this at around line 86:

$params['onClosed'] = 'close';

It should be after $params['href'] = '#cboxNode';

That was removed due to this issue: #1684784: colorbox closes with error on Firefox

iLLin’s picture

Hmmm, i just woke... no idea why I that ^ would work. LOL. I will look into when I have time.

iLLin’s picture

OK, what do you mean by a 301 Redirect? You need to fill in the redirect URL in the webform settings page. I'm not sure if there is token replacement in that URL or not. Look at this code here:

    else {
      // We are doing a redirect so we need to close the colorbox
      // and then force a window.location on the passed in URL.
      $markup = '
      <script type="text/javascript">
        (function ($) {
          $(document).ready(function() {
            $.fn.colorbox.close();
            window.location = "'. drupal_lookup_path('alias', $node->webform['redirect_url']) .'";
          });
        })(jQuery);
      </script>';
    }

That is what does the redirect. Not sure what you are doing as it seems custom.

iLLin’s picture

OK, I found the problem. Give me a few and I will post a patch.

iLLin’s picture

Status: Active » Needs review
StatusFileSize
new1.17 KB

This patch should do it. Tested it out and let me know then I will commit it.

murz’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, this patch works well on both my sites!

iLLin’s picture

Status: Reviewed & tested by the community » Closed (fixed)