Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Form Questions

Retrieving data out of Check Boxes - Groups


3 Posts   379 Views


15 February 2012 at 11:54am (Last edited: 15 February 2012 11:57am), Community Member, 8 Posts


I have created a form using the form module. This contains a Checkbox group I am now trying to extract the values from each of the check boxes in that group. Can anyone point me in the direction of a tutorial or example or explain how I could do this?

For information, I am doing this in the forms controller class, within the process function. I normally get the values out of fields by doing the following:

function process($data, $form) {
$this->weekType = $data["EditableDropdown42"];
// Run through form to get the job type
foreach ($this->Fields() as $field) {
switch ($field->Name) {
case "EditableDropdown3":

Can anyone help please?

Thanks in advance, Sean


16 February 2012 at 1:25am (Last edited: 16 February 2012 1:26am), Forum Moderator, 1091 Posts

Do a var_dump($data); or a

foreach($data as $key => $value) echo"$key - $value<br />";

to see what gets posted


16 February 2012 at 5:21am (Last edited: 16 February 2012 5:23am), Community Member, 8 Posts

Nearly got it? The dump returns the following :

'EditableCheckboxGroupField14' =>
'aaa' => string 'aaa' (length=3)
'ccc' => string 'ccc' (length=3)

where both aaa and ccc are the names of each tick box (that are ticked). However the foreach does not execute so I can't tell whats in the array:

foreach ($data[$field->Name] as $key => $value) {
echo"$key - $value<br />";

The code does not even get into this loop.

Any help most appreciated.