Hello all, The basic value of 1 for the checkbox has been working out well for a while. Now I need to change the value to something else so it's easier to handle when the value is placed into my DB. Bellow is the code I'm using for my checkbox group.
// initialize type checkbox
$chkboxtype[] = &HTML_QuickForm::createElement('checkbox', '1', null, 'Hearing Impaired');
$chkboxtype[] = &HTML_QuickForm::createElement('checkbox', '2', null, 'Visual Impaired');
$chkboxtype[] = &HTML_QuickForm::createElement('checkbox', '3', null, 'Mental Health');
$chkboxtype[] = &HTML_QuickForm::createElement('checkbox', '4', null, 'Assisted Living');
$chkboxtype[] = &HTML_QuickForm::createElement('checkbox', '5', null, 'Independent Living');
I assumed 1,2,3,4,5 would be the values but my assumption is wrong(so I think). I grabbed the value array structure and printed them out. My code for that is:
//sets field value arrays to variables.
$org_type_checkbox = $form->getElementValue(chkboxtype);
//create comma seperated values.
$org_type_values = implode(",", $org_type_checkbox);
//print array structure here for tests
print_r($org_type_checkbox);
$chkboxtype array structure:
Array ( [1] => 1 [2] => 1 [3] => 1 [4] => 1 [5] => 1 )
Heres a scenario:
A user clicks the 1st and 5th checkbox. Then the comma separated value will produce 1,1. I would the values to produce 1 and 5 so the comma separated value will produce 1,5.
How do I change the value for the individual check boxes so the first checkbox equals 1 , the second checkbox equals 2, etc....
-Rich