Hi all,

I wanted to have an area on my front page where visitors would be able to provide their email address to subscribe to a newsletter. To do so, I've created a webform with only an email field and a "Subscribe" button, then I used a view to display it in a block on my front page.

On the webform edit page, I've set the redirection URL to my frontpage's nid. Thus when clicking on "Subscribe", visitors will stay on the front page.

Now, I'm looking for a way to display a confirmation message too. For the moment, although visitors stay on the front page, they don't get any feedback about the subscription they just made, they don't know if it was successful or not. How could I do this? On the webform edit page I can only set either a redirection URL or a confirmation message, but not both.

Thanks!

Comments

hackwater’s picture

Use drupal_set_message in the "Additional Processing" field and leave your redirect in the "Confirmation message or redirect URL" field. Or you can set both in the Additional Processing field using drupal_set_message for the confirmation message and $node->webform['confirmation'] for the redirect.

mdupont’s picture

Thanks for your help. It appears that in latest releases of weform.module one can choose to generate a block, without having to create a custom view. And if one is only displaying a confirmation message (prefixed by "message:"), one stays on the same page without being redirected, which is perfect.

dkabal’s picture

Jose:

Thanks! This was perfect, as I encountered the same question!

Cheers,
Dave

aiphes’s picture

great way but how to display a text message with html and drupal_set_message ?

i tried this but doesnt work :

// Message de confirmation
drupal_set_message("Merci pour votre offre de stage.Elle sera traitée rapidement.");

thx

Dev Server Shared Hosting
8 websites powered by drupal 6,8 & 9 - Hosted by Always Data