Last updated 9 December 2016. Created on 20 February 2012.
Edited by jrockowitz, peterx, neha.gangwar, nally. Log in to edit this page.

Webforms can be used in a block. (Webform 7.x-4.x) Webform Ajax can be added to update the form in the block without reloading the page.

Create your webform in a node.
Edit the node.
Select the Webform tab.
Select the Forms settings tab.
Select Advanced settings.
Check [ ] Available as block.
Save configuration.

Your webform is now available both as a content node and a block. You can hide the node or use it however you want. In particular, you can suppress the display of the form on the node detail page under Manage Display for that content type. Look in the blocks list for the block. If you named your webform Example form, the block will be named Webform: Example form.

Configure block

Select Administration, Structure, Blocks, scroll down to your block, then select Configure for your block. The block gives you the following choices.

Block title

The usual block title option.

View mode

  • Form only
  • Full content
  • Teaser
  • RSS
  • Search index
  • Search result highlighting input
  • Form only is typically used to avoid duplicating the node's title (in addition to the block's title) and any other node fields which are set to display in the selected view mode.

    Multi-page handling

    • Display all pages inside block
    • Redirect to the node page after the first page

    The rest of the usual block options

    You might want to think about visibility here. You could confuse users when the form appears on the same page as the node version of the form.

    You might want to limit the block to certain pages and control the visibility of the pages instead of the block.

    Confirmation message

    Display as configured in the webform
    Display the confirmation page in the block on the same page (no redirect)

    When the confirmation message is configured to be shown in the block and the webform's redirect is set to the confirmation page, the block is replaced with the confirmation page. Otherwise, the confirmation message is added to the beginning of the block, ahead of the form, styled as if it were a standard Drupal status message. Webform Ajax

    Enable Ajax mode and Show confirmation screen options.
    Be sure to select "No Redirect" from Redirection options.

    Webform Ajax is quiet good solution without reloading the page. After submitting the webform in block it directly displayed the message in same webform block.

    webform_ajax_block.txt2.15 KB

    Looking for support? Visit the forums, or join #drupal-support in IRC.


    doomed’s picture

    thank you.