Hi and thanks for this great module. I use it more and more often, and I'm very satisfied with it.

I created a very simple form form which I call through the colorbox-load feature with a /colorbox/form/my_form path. Except for the AFAIK undocumented hook colorbox_form_access which took me a time to know about, all went well and my form is there.

But styling doesn't work : the main css classes are not taken into account (even with some claases like
Iframe #form_id {some styling}

I tried using the #attached property of the form but it didn't work either.

A drupal_add_css in the form building function did no good.

I noticed the HEAD tag in the colorbox Iframe is empty, not loading any CSS. Perhaps the problem lies here ?

As of now, I ended up embedding the styling in #prefix, #suffix and #attributes options but it's not ideal, and I would be thankful for any advice coming.

Comments

Countzero’s picture

Updating :

For the same reason, an Ajax form won't work in a Colorbox because no Javascript is included so the form is never processed by Drupal's ajax functions.

I tried to ajaxify the form because it doesn't seem able to pass the validation functions and give output from validation errors and the like. If the form processing doesn't work, the functionality seems pretty useless to me, so I must be missing something. Maybe my method is wrong in the first place ...

frjo’s picture

An iframe will never pick up the CSS from the main page, you need to add it separately to the page you open in the iframe.

Countzero’s picture

Yes, I should have known that.

There are issues with the lazy loading capabilities of D7 though, which are related to this one I guess : http://drupal.org/node/561858

jonlhouse’s picture

I'm having a similar problem. I have a form with a colorbox enabled link to open up a popup and present another form. The result of the popup frame should be sent back to the original form as the "result". The form appears correctly in the colorbox but is not Ajax enabled.

Is there a way to manually add the ajax JS? Maybe through drupal_add_js or drupal_add_library?

Additionally, I'm at a bit of a loss trying to figure out how to return a value computed in a colorbox form back to the original page any tips or links would be appreciated. Thanks,

John

frjo’s picture

Status: Active » Closed (won't fix)

Form support will most likely be moved from Colorbox module to the new Modal forms module.

http://drupal.org/sandbox/frjo/1095052