I wanted a contact form within a block and couldn't find one that did the job, not even the Quick Contact Block hack. But I've taken you module, copied the code in to a block and got it working no problem. The only thing I'd like to change is where the confirmation message appears.

I would like the confirmation message to appear within the block once the user has clicked submit, rather than redirecting the user to a confirmation page. Is this possible?

Comments

quicksketch’s picture

How about as a message on the page? The webform is going to refresh the page no matter what, so you could use the additional submit code to make it print the confirmation message and return to the original page.

drupal_set_message($node->confirmation);
$node->confirmation = $_SERVER['HTTP_REFERER'];
Drupal Centric’s picture

Would this print the message then auto redirect to the page the user was on? Or does the message appear on the page the user is on?

I just need to make it obvious that the form has been sent, ideally printing the message within the block but if it appeared at the top of the page that would work.

quicksketch’s picture

It would print it in the message area of the original page the user was on.

Drupal Centric’s picture

I put the code within the content section in the page.tpl.php of my theme but not sure if it had any effect. Once I submitted a form it took me to the confirmation page. It didn't print the confirmation on the current page I was on? It working great apart from this.

quicksketch’s picture

so you could use the additional submit code...

Enter this code in the "Additional Submission Code" under "Advanced Options" for your webform.

Drupal Centric’s picture

That's working great thanks but, there's always a but, it doesn't show on my frontpage? I'm using the Front Page module. I don't mind if I have to move where the message displays.

Drupal Centric’s picture

Status: Active » Closed (fixed)

The front_page module was stopping the confirmation message so have now disabled this to get message to appear correctly. Thanks again.

m@rtijn’s picture

Which code?