Drupal has a type of content called a block. Blocks are typically displayed in one of the sidebars of a site, although it is possible to place them in most regions of our theme.
In a very general sense, blocks are chunks of discreet content that are meaningful in their own right, but separate from the main content of a particular page. A familiar example of a block is where we log in to our website.
Drupal blocks are highly configurable entities, to the extent that we may specify on which pages a block should show, or the sequence in which multiple blocks are displayed in a particular theme region. We can discover more about blocks in the Drupal documentation at http://drupal.org/documentation/modules/block.
On the Webform Form settings page, we have the option to make our form available as block content.
Webform as Block
into the text field under Block title and then select the Form only option under Display mode.The Webform module makes it possible to render our forms as either traditional Drupal nodes or as blocks. If we were making a custom Contact Us form, for example, that has only three or four fields, it seems wasteful to have this tiny form occupy an entire page. Such forms are possibly best placed in a block where they can be accessed directly from almost anywhere on our site because, as blocks, they are independent of the node content area of our site.
It is recommended to use a fluid width theme when displaying our forms as blocks in sidebars. Fixed width themes can have difficulty displaying forms neatly in sidebars (as we saw previously). However, this can be overcome by tweaking input field widths and so on.
We have a few options that affect how our form will display and behave when we use it as a block.
When we initially created our Webform we filled out a Body field. The text we entered here displays above the actual form portion of our Webform, that is, above that part of the page where our fields start being rendered.
When we opt to display our form as a block we have three display options to choose from in our block configuration:
Which of these we choose to implement would depend very much on our reasons for having the form available as a block. For a miniature contact form it would probably serve us to display the form only, whereas a more complicated form should probably use the teaser option to attract interested parties to our form proper.
This option only applies to multipage forms. Webform offers us the choice of having all of the different pages of our multipage form display within the block or only the first page.
If we leave this option unchecked then our form users will be redirected to the Webform node when they click on the Next page button. They would fill out the fields on page one and be redirected to the full node displaying page two.
When we check this option, the main content area of our site will not change as our users progress through our various form pages.
It seems somewhat counter-intuitive that Webform error messages arising from forms displayed as blocks should display above the main page content. On the face of it, we would expect these error messages to appear in our Webform block.
The reason for these messages appearing above the main page content is very simple: like all good modules, Webform uses the core Drupal error messaging system. Most themes are set up to render Drupal error messages at the top of the main content area. The unexpected behavior is theme driven, not an inadequacy in Webform.