I have created a contact us form using webform module, now i want o render this contact us form in a block , how to render it. I have used $form = drupal_get_form('webform_client_form_54') ; drupal_render($form) but it is not working.
Thanks.

Comments

eric_a’s picture

Project: Drupal core » Webform
Version: 7.4 » 7.x-3.9
Component: other » User interface
Category: feature » support

There is very little point in trying to do this programmatically. See also #1140354: Webform - How to make a block.

quicksketch’s picture

Status: Active » Fixed

Webform can make any form into a block natively if you enable the "Expose as block" option under the Webform -> Settings tab on the Webform node.

mattmm’s picture

I just got this working and I'm wondering how you can pass the node URL into the webform results? the NID token just returns the original node that the web form was created as. However, this form resides on multiple pages and knowing which page the person contacted on is important.

Thoughts?

quicksketch’s picture

You can use %get['q'] as a token to record the internal Drupal path (which will contain the NID).

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.