Hey all ... trying to get the checkbox selected values in the gform_pre_submission filter.
My checkbox field ID is 8.
I am looping through the $form['fields'] to isolate just the data in the checkboxes in field 8 like this:
foreach($form['fields'] as &$field) {
if($field['id'] === 8) {
$selectData['inputs'] = $field['inputs'];
$selectData['selections'] = $field['choices'];
}
}
$selectData gives me all data like:
Array
(
[inputs] => Array
(
[0] => Array
(
[label] => Appliances
[id] => 8.1
)
[1] => Array
(
[label] => Book Stores and Stationary
[id] => 8.2
)
[2] => Array
(
[label] => Fashion and Accessories
[id] => 8.3
)
[3] => Array
(
[label] => Food and Beverage
[id] => 8.4
)
[4] => Array
(
[label] => Home and Living
[id] => 8.5
)
[5] => Array
(
[label] => Technology
[id] => 8.6
)
)
[selections] => Array
(
[0] => Array
(
[text] => Appliances
[value] => 9
[isSelected] =>
)
[1] => Array
(
[text] => Book Stores and Stationary
[value] => 10
[isSelected] =>
)
[2] => Array
(
[text] => Fashion and Accessories
[value] => 8
[isSelected] =>
)
[3] => Array
(
[text] => Food and Beverage
[value] => 6
[isSelected] =>
)
[4] => Array
(
[text] => Home and Living
[value] => 7
[isSelected] =>
)
[5] => Array
(
[text] => Technology
[value] => 15
[isSelected] =>
)
)
)
However in the [selections] array I'm expecting the [isSelected] value to be set to something but it isn't. In the example above the form was submitted with Appliances, Food and Beverage and Home and Living preselected (checked) in the form and then Book Stores and Stationary checked manually.
What am I missing? The gform_pre_submission filter should have access to all submitted form data shouldn't it?
Thanks