[themes] how to theme [class/id] a nord_form?
Lee Rowlands
leerowlands at rowlands-bcs.com
Wed Nov 11 03:05:58 UTC 2009
> When I have a nord_form, either for creation or editing, I get a lot of
> id's like: #thmr_81, thmr_86, #thmr_91, #thmr_98
These are inserted by the devel_themer module and should not be relied upon
> But if I replace $output .= drupal_render($form); with
>
> $output .= drupal_render($form['title']);
> $output .= drupal_render($form['body_field']);
> $output .= drupal_render($form['custom_select_field']);
>
> Which are the only three I actually need to have displayed for a
> non-admin, then the page will NOT save, [no errors, it just reloads the
> page and erases all my changes]
The call to drupal_render($form) actually renders the hidden elements such
as form id and build id which are needed to determine if the form was
submitted by the Form API. If these aren't found, the Form API thinks it
wasn't submitted and hence no submit function is called and no data is
saved.
You need to examine the $form variable and unset (using the unset function)
any array members (form elements) you don't want then add a final
drupal_render($form) to the end of your output and thiss will add all the
hidden stuff (and anything else that still yet to be rendered).
I'm assuming you don't have a module here? Otherwise you could do the
unsetting in hook_form_alter.
More information about the themes
mailing list