I have a WebForm Survey which I want to show in a page through LightBox.

The LighBox part is all sorted but I am stuck in getting a link to the WebForm Survey.

Here is what I did:-

  • Created a WebForm Survey
  • Made it available as block (It can be seen in Structure>Block as Webform: Self - Assessment Survey)

Now on a Page (About Us), I have a link "Open Survey". What I want to do is, that when this link is clicked, my Survey should open in a LightBox.

I tried doing this Open Survey, but this never opens my WebForm, and instead shows a 404.

What should I Do?

Many Thanks.


This isn't possible at present, not automatically any way.

You could write some javascript to find all "/contact" links and append "/lightbox2" to it so it's "/contact/lightbox2". You would also need to add a rel="lightframe" to the anchor link. This would open the contact form in a lightbox when the contact link is clicked, and you could style the form with a page-contact-lightbox2.tpl.php template file in your theme's directory.

However, this will open the form in a iframe, rather than treating it like modal content which is what is done to the login form. The disadvantage to using an iframe is that the form isn't closed upon form submission, like with the login form. The advantage is that the iframe will add a scrollbar to accommodate the size of the content. If you want, you can treat it as modal content (just use rel="lightmodal"), but you'll need to specify the height and width of the lightbox container (see lightbox2 docs).

I'm not adding it to lightbox2 module at this time because there are too many modules that modify the contact form content, e.g. advcontact, contact_forms, content_attach, captcha, mollom, etc. These potentially could modify the size of the content, making it difficult for lightbox2 to estimate the outputted form size.

If enough other people request it, then I'll add the ability for lightbox2 to open the default contact form in a lightbox, but for now, this feature won't be implemented for the reasons outlined above.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.