By rs7272 on
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
Comments
if it's important...
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
Nodeasblock Module is perhaps what you're looking for.
- p6
www.bas.org.in
- Pavan Keshavamurthy
http://grahana.net/
I tried to use nodeasblock
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
Using the Views module, create a block that displays the single full node for the webform.
Views+webform
Superb! That works a treat for me!
Genius
Genius. I tried this and it worked superbly. I am using the Viewfield module (http://drupal.org/project/viewfield) to allow you to add a view field to a CCK content type. I have a "Page" content type which has the field, so I created a view showing just the one webform and can now include that webform on multiple node pages. Fantastic, thanks, I'd never have thought of doing that.
Excellent Suggestion!
Creating a block View is very clever and easy, thank you for the suggestion!!
If anyone is trying to do this:
Why can't everyone be this clear?
Just wanted to say thanks.
Your instructions were simple and clear.
In fact, it helped me to learn a little more about Views.
Great post.
Excellent instructions! Like
Excellent instructions! Like MichaelBrown, in addition to working perfectly, these steps helped me understand Views more. I wasted some time trying to use the Webform Block module before using your instructions, which do the job better & don't require an extraneous module.
Thanks! This saved me a lot
Thanks!
This saved me a lot of time :)
Excellent!
What a breath of fresh air to get a simply explanation! Thanks so much I agree has made views make a little more sense aswell.
Thanks again!
Node ID filter is more reliable
I'm glad it was helpful! I wrote the post above during my first few weeks of Drupal/Views use, and unfortunately I can't edit it now.
I'd strongly recommend using a Node ID filter over Node Title/Type. Changing the webform's title will break things if the Views filter depends on it.
Problem: Only a link to my webform in block?
I am sorry, I am a newbie and tried using views (as per Excellent Suggestion) and the block is there, BUT I only get a link to my webform node. I want the webform displayed on the page in the left side bar block (it's a contact us fast form). What am I doing wrong? sniff, sniff.
DISREGARD THIS POST - I LEARNED MORE ABOUT VIEWS AND GOT IT TO WORK.
Thanks for sharing how! For
Thanks for sharing how!
For anyone else who had this problem, it's because views is displaying the node teaser rather than the full node. There should have been an option to change this whilst setting up the view, but if you missed it you can also fix it here:
1. Go to your web form edit page
2. Expand 'Webform advanced settings'
3. Tick 'Show complete form in teaser'
4. Save
First thank you, but...
Hi, I did the block that display the webform, but when this webform is fill it creates a content and not a submission to that webform. Can someone tell me what Im doing wrong?
Than
There is a much simpler
There is a much simpler solution with the never versions of Webform.
Simply edit your Webform, then click the Webform > Form Setting tabs. Scroll down and expand the Advanced Settings. Check the "Available as block" checkbox. You now have your webform as a block.
Now built into webform
Don't know if this has been answered before but this is now built into webform, stumbled across it today.
When in editing webform goto:
webform -> form settings -> Advanced settings -> now "tick Available as block".
Hope this helps somone.
should the path be -
should the path be - /admin/settings/webform?
i found it once before and now i can't find it again. =-/
View the webform, there will
View the webform, there will be additional tabs for users with appropriate permissions, one will be for that webforms settings.
oops, i figured out my
oops, i figured out my mistake. you actually have to create a webform first. duh, my bad. thanks much for the reply!
It may not work and pasting the form is likely to fail
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...
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,
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.
I just wish I found this two weeks ago...
Views in Drupal 6.x
Views thus far in Drupal 6.x show the teaser, but not the form part itself. Any workarounds?
Change Row Style: node settings to full node
You might need to change Basic Settings / Row style: Node / settings = Node (instead of teaser)
Thanks mate. This really
Thanks mate. This really helped for me
Use the node_view function
I created a new block with the input format as PHP and used this code to get it to work:
Use the node_view function
Worked well for me, thanks!
Would you be able to tell me
Would you be able to tell me how you set up views to show webform? I've tried but can't manage to do it.
Also can you set up a view to show the node how it actually looks as it seems to unformat everything?
Thanks
ignore me worked it out!
ignore me worked it out!
Could you tell me exactly
Could you tell me exactly how you worked it out? I'm new to drupal and views and it's not making sense to me. I'm using Drupal 6 and webforms. I'm trying to get a specific webform to show up in the sidebar as a block using views. Is there a simple way to do this without using code? Thanks, Rani
look at the post titled
look at the post titled excellent suggestion, thats very clear on how you get your form displaying in using views, just make sure you add display "block", then you just go over to administer -blocks and place the block (which will show up on the list of blocks now) where you need it.
styling may be a different issue alltogether, I havent gotten that far yet
webformblock
You can also use the module webformblock.
Does anyone have a view ( no
Does anyone have a view ( no pun intended ) on whether the webformblock or Views approach is preferable. My site already has Views installed ? Any pro's or con's ?
Cheers
Dave
Duh, create a Views block, of course!
Duh, create a Views block, of course! Thanks davegan for suggesting that, and to rupl for giving the step-by-step. I knew there was an easy answer.
FYI, make sure you select "Show complete form in teaser" in Webform Advanced Settings or you'll just see "Go to form" in your block.
Score one more for Views -- I avoided installing another module.
Argh
Using a Views Block is not working for me, sorry to say: the text is there but the form elements are missing.
Can anyone please advise on what's wrong with this exported View?
$view = new view; $view->name = 'sign_up_block'; $view->description = 'Sign Up block'; $view->tag = ''; $view->view_php = ''; $view->base_table = 'node'; $view->is_cacheable = FALSE; $view->api_version = 2; $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ $handler = $view->new_display('default', 'Defaults', 'default'); $handler->override_option('fields', array( 'body' => array( 'label' => '', 'alter' => array( 'alter_text' => 0, 'text' => '', 'make_link' => 0, 'path' => '', 'link_class' => '', 'alt' => '', 'prefix' => '', 'suffix' => '', 'target' => '', 'help' => '', 'trim' => 0, 'max_length' => '', 'word_boundary' => 1, 'ellipsis' => 1, 'html' => 0, 'strip_tags' => 0, ), 'empty' => '', 'hide_empty' => 0, 'empty_zero' => 0, 'exclude' => 0, 'id' => 'body', 'table' => 'node_revisions', 'field' => 'body', 'relationship' => 'none', ), )); $handler->override_option('filters', array( 'nid' => array( 'operator' => '=', 'value' => array( 'value' => '13012', 'min' => '', 'max' => '', ), 'group' => '0', 'exposed' => FALSE, 'expose' => array( 'operator' => FALSE, 'label' => '', ), 'id' => 'nid', 'table' => 'node', 'field' => 'nid', 'relationship' => 'none', ), )); $handler->override_option('access', array( 'type' => 'none', )); $handler->override_option('cache', array( 'type' => 'none', )); $handler->override_option('items_per_page', 1); $handler = $view->new_display('block', 'Block', 'block_1'); $handler->override_option('block_description', ''); $handler->override_option('block_caching', -1);
The webform module now has an
The webform module now has an option to expose the form in a block.
webform block in drupal 6
Don't use the Webform block module - it's not updated fast enough and it's not compatible with the latest D6 webform version. The views solution is preferable.
Has anyone got this to work
Has anyone got this to work with ajax? I've installed the ajax module, activated the webform ajax module, and activated the content type in the settings, but it still doesn't work work while in a block.
Thanks
Idan
Fighting with the same
Fighting with the same problem right now. :-S
Error messages displayed in main content div...
Hi all,
does anyone have any idea how to prevent error messages being displayed in the main content div?
I want to display them within the block self.
When I submit the form in the block and let the fields blank... the form itself opens in the main div with error messages.
THX in advance
greetz
jack vanlommel
Same problem
hi jack
fighting with the same problem do u get the answer of this query.....
Hi Jack, I had the same
Hi Jack, I had the same issue, which is a shame as I would rather use the Views solution than install another module. But as others have found Webform Block worked for me:
Webform Block:
http://drupal.org/project/webformblock
Using Jquery with Drupal behaviors to replace the form action
I was having trouble with this in a situation where I wanted to reuse a single webform in two sections of our site. Our node id was node/21, but the page url(s) I wanted the form located on was called residential/contact and commercial/contact. These both worked fine until a user tried to submit the form and there were validation errors, the form would submit to the node breaking the design around the form. After fiddling around with the view solution mentioned here and still seeing the same issues, I resorted to the following code to change the form action to match the page url. Easy, simple, clean.
I created a file called behavior.js and put it in the theme's root folder.
In my theme's .info file, I placed a reference to behavior.js:
scripts[] = script.js => This is the orginal line.
scripts[] = behavior.js => This is the addition.
Then the code in behavior.js was 5 simple lines.
However, when the form is submitted successfully, it loses page context again. Does anyone know exactly which file I would need to put in my theme folder to override the form redirecting back to the node when the form processing completes and instead redirect back to the page url the form was placed on?
Note: I'm using Drupal 6.16, Webform 6.x-3.0-beta5 and Nodes in block 6.x-1.5 to get the form to show up on multiple pages.
Webform's Redirect URL box
Hi Russell,
If you don't mind putting a PHP snippet into the Webform Redirect URL field, you can use something like this:
Of course, you could also put this code in a module and use hook_form_alter to achieve this.
subscribing
Thanks for the great answers.
Try Webform Block
I've been looking for a solution to this for months. Fortunately, I just found an amazing new module which solves this problem!
Webform Block:
http://drupal.org/project/webformblock
webform in block
yeah...it can. just visit the webform advance settings and see for block option. enable it and u have done what u want...now webform will appear in blocks.
Confirmation - gotosachin18 is right
Can confirm, in recent versions on webform, forms are available to be displayed in a block from within that webform's settings:
Visit webform > Hit 'Webform' tab in edit menu > Form Settings > Advanced Settings > tick checkbox next to 'Available as block'.
Relevant block should now appear in 'disabled' area of block configuration page.