Pedro Posada | Webform form insert

Webform form insert

Posted on April 24, 2008 - 4:40pm
<< 37 of 50 >>

Php snippet to insert a webform in any node.

<?php

// load the webform node
$ourform = node_load(2);

// insert 4 parameters
print drupal_get_form('webform_client_form_2',$ourform,array(),'','');

?>

Submitted by Slava (not verified) on July 11, 2008 - 5:43am.

I put this snippet into sidebar block but all field were disabled! And there were no "submit" button!

Submitted by Chris Free (not verified) on August 20, 2008 - 2:05pm.

Thanks, this is exactly what I was looking for!

Submitted by Anonymous (not verified) on August 18, 2009 - 8:58am.

How could you target the exact node you want to put the web-form into? I would like to add a web-form into a specific information page...for example say it was node 5. Thanks very much.

Submitted by pedro on August 18, 2009 - 11:44am.

Insert the snippet in the body of the node.

Go to the node and edit it. Then just paste the snippet inside the body and select PHP as the input format.

Submitted by Anonymous (not verified) on August 20, 2009 - 11:36am.

Thank you. That worked.

Submitted by Chris (not verified) on October 22, 2009 - 2:16pm.

Is the third parameter passed an array of the WebForm's Submitted Values?

If so, is it possible to put values in that array in order to pre-populate some of the fields when the webform is displayed this way?

Note: I know that when you build the WebForm's Form Components you can insert Tokens to pre-populate fields, but I'm trying to be more creative.

For example, I have a single registration WebForm that is rendered in several nodes that have details about several upcoming Seminars. Since we have many seminars, I want to populate a hidden field with the name of the seminar when the user submits the form.

Normally, if the Form was not rendered within the node, I'd tack the Seminar Name data into the URL of the WebForm and use to %get token to populate the hidden field.

If it is possible to pass variables in that array() parameter, what is the structure and syntax of that array in order to achieve that?

Thanks,

Post new comment

The content of this field is kept private and will not be shown publicly.
Please solve the math question. This way we will know you are not a robot.