Thursday, September 22, 2011

How to display webforms in colorbox in drupal

I've found an easy way to implement this feature without coding that works for me:
  1.  you can enable webforms as a block --> select the webform content you created, tab "Webform" > "Form Settings" > "Enable as a block"
  2. put the block inside a region, I've put mine in the footer region
  3. CSS style the footer webform block as "display: none;"
  4. for colorbox: in "configuration", "Media", "Colorbox" --> advanced settings, activate "Enable Colorbox inline"
  5. add this as the html code for opening the colorbox webform link: <a class="colorbox-inline" href="?width=310&amp;height=460&amp;inline=true#name-of-your-block">

7 comments:

  1. Hi am following ur steps..but when i click on image i have given link as you mentioned.but it displaying blank colorbox.how to fix it?

    ReplyDelete
  2. there is nothing show in colorbox

    ReplyDelete
  3. I also get a blank. I have tried a lightbox but this shows the whole page. It seems that there is only 1 or 2 option for webforms

    ReplyDelete
  4. thanks for help. you save me a lot of time.

    ReplyDelete
  5. Hi
    thanks but what does name-of-your-block stands for ??
    is it for block class, Id, title or something else.
    pls reply

    ReplyDelete
  6. Hello.
    This solutions, how published "step by step" not working! Because we hide webform block (3 step), when we call colorbox - i see empty block (webform has display:none).

    But this very very light fixed - add in css other rules -

    #cboxLoadedContent #block-webform-client-block-7 {
    display:block;
    }

    do not forget change block name!!!

    Evgeniy.

    ReplyDelete