1

I am using the Webform module, and I've created a block containing a webform. When I submit the form, my browser goes to the main url for the webform.

How can I display a thank you message instead?

3

You can do it,from web form configuration page...use redirection location or confirmation message.

enter image description here

0

Use hook_form_alter in your custom module (better create a new custom module). Get the form id for the webform A using inspect element or firebug. Once done, you alter the submit handler for the webform.

The #redirect is what makes you to redirect to webform url, you might need to unset or change that. Use Drupal_set_message() in your custom submit handler to print the thank you message.

0

Reference of the link : Creating a hook_form_alter for webform

ou just need the id of the node and then use the id like in hook_form__alter()

the FORMID generated is webform_client_form_

where NODEID is the id of the node

so if you have a module named mymodule and a node with id 44 which has a webform

function mymodule_form_webform_client_form_44_alter(&$form, &$form_state) {
$form['#redirect'] = 'your path';
}
  • can you please tell me what I put in the place of mymodule ? and there I this code ?in side template.php right ? – Nikunj Jagad Nov 11 '13 at 9:25
  • your custom module name that is hook_name you should place above in your custom_module you may have created – harshal Nov 11 '13 at 10:10
  • I used webform module and crated block for webform ,its no working – Nikunj Jagad Nov 11 '13 at 10:24
  • drupal.org/node/542202 ->this is the link for creating a .info file and then create a .module file and inside that write the above code.Create a directory with the module name and place .info and .module file inside it .Enable the module and then you can work on the code and change the path using #redirect – harshal Nov 11 '13 at 10:40
0

You can follow the below step to redirect webform submission.

  • Create a node using "Basic Page" content type or you can create any custom page or any panel page.
  • Edit your Webform page. When you edit your webform node, you will find "view", "edit", "webform" links in your top of page.

  • Click on "Webform" link in top of page and it will display the webform configuration for the node.

  • Click on "Form settings" in webform configuration.

  • In the "Redirection location" section, check radios button "Custom URL" and add the url of your page in textbox.

Kindly see that if you will create node content, then your url will be "node/[nid]" or if you create any custom page or panel page, then your url will be different.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.