can a webform be in a block?

rs7272 - April 25, 2007 - 18:42

Other than copy and past the code from a webform, is there a way to make it a block. For example, I want a form to always be in the left column of my site and if I change the webform I would like it to update in the left column automatically rather than having to copy/paste the code from the form page to the block. Certainly not a showstopper, but I'm lazy :)

thanks

if it's important...

rs7272 - April 25, 2007 - 18:51

If anyone cares, the site I'm wanting to add this to is www.lawinfonet.net - they want the form to be on the left column (with all the other business...) Again, I have done that before by copy paste, but I want them to be able to change the webform if needed and have it update in the block, not just the actual webform page.

Nodeasblock Module is

p6 - April 25, 2007 - 18:57

Nodeasblock Module is perhaps what you're looking for.

- p6
www.bas.org.in

I tried to use nodeasblock

keylope - August 15, 2007 - 17:52

I tried to use nodeasblock with webform and unfortunately, the actual form doesn't display in the block form. Only the title and description.

Oh well.

One Possible Solution

davegan - April 25, 2007 - 18:59

Using the Views module, create a block that displays the single full node for the webform.

Views+webform

siliconmeadow - July 6, 2008 - 10:16

Using the Views module, create a block that displays the single full node for the webform.

Superb! That works a treat for me!

It may not work and pasting the form is likely to fail

nevets - April 25, 2007 - 19:24

I have not used webform but there are some issues you should be aware of. The first is to see how the action is set, it normally defaults to the page being viewed and in the case of placing a form in a block this would be incorrect. Modules like the search module set the action so they will work in a block. A quick check shows action not being set by the webform module so this would be an issue.

And cutting and pasting a form will generally not work in Drupal as it does security checks to avoid unwanted postings but it generally means forms not generated with the forms API will not work. And while the original form is produced by the form API, there are parts of the form data that are dynamic and "expire" after a certain amount of time.

Pasting does work...

rs7272 - April 26, 2007 - 13:56

After I make or update the webform, I can view source and copy / paste it in a block and it works fine, but they want to be able to update the webform and have it be updated in the block too without having to copy paste - it will be rare if ever that they make changes anyway...

The views solution works,

arbel - August 15, 2007 - 20:48

The views solution works, I'm using it now, and that's the only way I managed to work around that bug.

Idan

Using views worked for me too.

chris_d_adams - September 7, 2007 - 08:01

I just wish I found this two weeks ago...

Views in Drupal 6.x

enlighten_me - June 27, 2008 - 19:34

Views thus far in Drupal 6.x show the teaser, but not the form part itself. Any workarounds?

Use the node_view function

Schoonzie - July 12, 2008 - 05:53

I created a new block with the input format as PHP and used this code to get it to work:

<?php
print node_view(node_load($nid), $teaser = FALSE, $page = FALSE, $links = TRUE);
?>

Use the node_view function

yumminy - July 24, 2008 - 16:13

Worked well for me, thanks!

 
 

Drupal is a registered trademark of Dries Buytaert.