I have a form where I am using radio buttons and when I use integers as the index, the form is saving and passing the value just fine. However if I use a string as the index it is saving nothing in the $form_state['storage']['values'].
Example - This works as expected:
$testArray = array(0 => 'test1', 1 => 'test2', 2 => 'test3');
$form['step0']['testthis'] = array (
'#type' => 'radios',
'#options' => $testArray
);
After submitting this example the $form_state will look like (with array index 2 selected):
- Form Storage -
Array
(
[values] => Array
(
[step0] => Array
(
[testthis] => 2
)
)
)
Example - This does not work as expected... for me!
$testArray = array('test01' => 'test1', 'test02' => 'test2', 'test03' => 'test3');
$form['step0']['testthis'] = array (
'#type' => 'radios',
'#options' => $testArray
);
After submitting this example the $form_state will look like (with array index test03 selected):
- Form Storage -
Array
(
[values] => Array
(
[step0] => Array
(
[testthis] =>
)
)
)
I expect it to output
- Form Storage -
Array
(
[values] => Array
(
[step0] => Array
(
[testthis] => test03
)
)
)
Any insight would be most appreciated!
Thank you.
Edit: I forgot to mention that the HTML element is output just fine. So using the string index the element looks like:
<input type="radio" id="edit-step0-testthis-test3" name="step0[testthis]" value="test03" class="form-radio">