div->div->div-standard+div-admin+submin-button My custom content type is" /> div->div->div-standard+div-admin+submin-button My custom content type is" /> div->div->div-standard+div-admin+submin-button My custom content type is"/>

drupal_render: how to make well-formed div structure of the form?

1k Views Asked by At

I noticed, forms "story_node_form" or "node_form" are formed like this: form->div->div->div-standard+div-admin+submin-button

My custom content type is not formed this way:

Problems:

1) My created table is on the top of the form, how can i move it down?

2) How can i place my table into collapsable group?

3) Why submit and preview buttons are on the top of the form below my table?

1

There are 1 best solutions below

2
Decipher On

Because you rendered your table, then the rest of the form it is acting as expected, whereas if you where to place it in the $form array with the appropriate weight it would be rendered where it is expected with only the one drupal_render($form).

As for the collapsible group, you'd want to wrap your form elements in a collapsible fieldset, like so:

$form['wrapper-id'] = array(
  '#type' => 'fieldset',
  '#title' => t('title'),
  '#collapsible' => TRUE,
);
$form['wrapper-id']['yourstuff'] = array(
  // Your stuff
);

For more information about modifying forms, refer to the Form API documentation: http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/6