I want to display a form (in a pop-up) window, that doesn't have the HTML associated with the (base) site theme. I want it to have very different characteristics. I plan on using CSS to get it that way, but first I have to get rid of all the other stuff.
I have succeeded in getting the form up on the window, but when I try to implement my $form['theme'] = 'theme_my_new_theme', I lose everything and have a white window, or I get my form on top of a messed up form-page. I am guessing I am confused about what should be "return"ing what. For some reason my drupal_render($form) inside my theme function is not working like I thought it should.
Any hints or suggestions? I don't want to use phptemplate, and I don't think hook_form_alter will help here...or will it?
Do I have to render each element, and not drupal_render($form)?
Thanks
Comments
Ba careful not to miss out
Ba careful not to miss out the # from the form structure properties (apologies if you know this!):
What you could consider using as an alternative to PHPtemplate .tpl files is the #prefix and #suffix form properties, which can be attached to every element of a form (including the form itself). Themeing each element is certainly the most flexible, but these two properties offer a quick and dirty solution.
Thanks BladeRider for #ing it in to me gently. ;)
I hate to admit how many times I forgot to do that, yet still I do it.
It took care of part of the problem. But it looks like $form rendering insists on including all the site html (< title >, menus, blocks). I can use my theme to alter the < form > part, but in this case I don't want anything else.
So I simply used a print $output, vs return $output, and that got me what I wanted. I was pleased to see the token is still passed despite this detour, I wonder if it will be still processed? Validate is being used, so I hope so.
My pop up form window is taking shape. Thanks for your help.
Found out that setting '#attributes' => array('onclick' => 'window.close()'), on the submit button makes it go away nicely too!
And I remembered the # the first time I typed it.