I am using webform to collect different information from customers and this webform will be accessible from body section of page and, to achieve this i am using this module. Currently, when i submit my webform it takes me to webform page but i want to stay on the same page. I tired using webform confirmation page and no redirection settings but it seems they are not working.

I also tried solution given in #19 comment but for this i need to provide URL of the same page.

So, is it possible to have any parameter or setting to close this popup after webform submit?

Thank you in advance.

Comments

butteryak’s picture

Adding the &destination=node/xxx works for me to redirect to a specific page on submit.

<a class="colorbox-node" href="contact" data-href="contact?width=600&height=600&destination=node/368">Contact Me</a>

The challenge I had was how to dynamically create that destination to redirect back to the page that I opened the colorbox from, so I just redirect to a confirmation, "thank you for submitting this form. and then with a little javascript create a "Return to the previous page" link.

Not elegant, but it works.

Also make sure your using webform-ajax module. I don't think my webform_ajax is working properly though, which may be why I had to do it the way I did.

abarpetia’s picture

Sorry for late reply. I used webform-ajax module but no success. I am not a good developing so would you like to share your javasript code with me?

Thanks in Advance.

swhitters’s picture

I've been looking for a solution to something similar for months. I'm no php expert so this can probably be streamlined, but here's what worked for me. This gets the URL of any page you put it on and I can keeps classes and the id for the link.

$a = 'BASEURL?width=500&height=500&iframe=false&destination=' . $_SERVER['REQUEST_URI'];
print l(  t('Request Information'),  $a,  array('attributes' =>array('class'=>'colorbox-node', 'id'=>'requestinfo') )); 
iLLin’s picture

Im confused on this thread as there is redirect stuff in place through the API. Please provide more information on what the problem is and what you are trying to do, so that I can point you in the right direction.

abarpetia’s picture

@iLLin: What I was after is a way to close Colorbox popup after Webform submission rather than redirecting to form submission page. I think this issue is already solved. If I enable Ajax Mode then user is no longer redirecting to webform page. Thanks

iLLin’s picture

Status: Active » Closed (works as designed)

ok Great!

delacosta456’s picture

hi @swhitters and @abarpetia

i am not ok with code so where to put this code in my below example:

i have a view with field display.
i have the "Add comment link" field added to view where i rewrite the result and output as link to add colorbox-node class which work perfectly.

Now i want the color box to be close after saving comment en refresh the page from which link was clicked