I'm just wondering.. is there a way to group textfields together, so that the values are available in an array, like the checkboxes, or the radios?

Comments

Michael M’s picture

Take a look at the "form_checkboxes" and the "form_radios" functions (notice the plural form of the word). They are in the /includes/common.inc file. Or check out the documentation:

http://drupaldocs.org/api/head/function/theme_checkboxes

http://drupaldocs.org/api/head/function/theme_radios

http://drupaldocs.org/api/head/group/form

chiggsy’s picture

What i want ( ideally ) is a way to have one array name for several form fields:
I have 10 checkboxes in section 1.. that array is called 'problems'
I have 10 more in section 2 of my form called 'solutions'
this is ideal, since i can access the individual fields via form['solutions'][['fieldname'] syntax
however i have a few textfields also. I'd like them grouped in an array as well if possible, so that i could serialize/unserialize 3 arrays into my db table , and add form fields freely as i work on this...

Is that possible?

_-dave-_’s picture

Hi chiggsy

Did you find a way to do this - I have the same requirement and can find nothing relating to it? Easy in plain php but cannot seem to find a way through the forms api...

Thanks
Dave