Possible Duplicate:
Theme Drupal Form API checkboxes as a grid

I would like to create a form that is able to accept values which will be saved into a multidimensional array. Is there an advised method on how to accomplish this with Form API?

As an example:

  |  A  |  B  |  C  |
--+-----+-----+-----+
1 |     |     |     |
--+-----+-----+-----+
2 |     |     |     |
--+-----+-----+-----+
3 |     |     |     |
--+-----+-----+-----+

I would like to have a textfield for each grid square and save the end value into a single array which will be serialized and saved as a variable.

EDIT: Just to clarify, I don't particular care if the form is output as a TABLE in a HTML sense, but it would obviously be nice to have it stored as a multidimensional array from a PHP perspective.

share|improve this question

marked as duplicate by Oswald, Clive, Chapabu, kiamlaluno Oct 14 '12 at 11:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

If you need a table and put checkboxes on the left you could use http://heine.familiedeelstra.com/new-tableselect-form-element-in-core

Alternative you could theme your form. Therefore you have to write a theme_form_id which drupal_render the elements and put them together with theme('table').

PS: This will perhaps land in drupal8: http://drupal.org/node/80855

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.