By zhangx1a0 on
I have some elements in a fieldset. Now I want to use theme_my_form to do the layout work. But I cannot separate the elements from their fieldset...
If I do not render the fieldset, everything is ok. If I render the fieldset, all elements in it will be follow the default layout... all elements rendered with the fieldset together I think...
How to deal with it?
Comments
Render the children first, then the fieldset
Rendering the children first allows you to theme them. You can then put the markup for the fieldset around your children manually and call form_render() on the fieldset (disregarding the output) to mark it rendered.
Greetings
--
~/.singatrue: file not found
still in trouble
thanks for your reply. But I am not very clear about your words. Did you mean that I should render children first then render fieldset after children? I tried this way. But in the output page, children elements are not in the fieldset but under the fieldset...
Something like this
Say you want to render the fieldset
$form['my_fieldset']. Do it like this:This should give you about the same output as the standard rendering. Now if you want to render the children differently you can change the foreach-loop that iterates over the children and add to
$my_fieldset. Remember to call form_render on the children as well, just like I didform_render($form['my_fieldset'])without remembering the result.BTW: This seems to be a hack, I've got the feeling there exists a better way.
Greetings,
--
~/.singatrue: file not found