Created
August 3, 2018 20:15
-
-
Save opi/da3c96f2401949d7d7103d50dd1c363d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$form['numeric_default_zero'] = array( | |
'#type' => 'radios', | |
'#title' => "Only numeric keys, starting at 0. #default_value to 0", | |
'#default_value' => 0, | |
'#options' => array( | |
0 => "key: 0", | |
1 => "key: 1", | |
2 => "key: 2", | |
), | |
'#description' => "GOOD: radio 0 is selected", | |
); | |
$form['numeric_default_false'] = array( | |
'#type' => 'radios', | |
'#title' => "Only numeric keys, starting at 0. #default_value to FALSE", | |
'#default_value' => FALSE, | |
'#options' => array( | |
0 => "key: 0", | |
1 => "key: 1", | |
2 => "key: 2", | |
), | |
'#description' => "GOOD: no radio selected", | |
); | |
$form['mixed_default_zero'] = array( | |
'#type' => 'radios', | |
'#title' => "Mixed numeric & alpha keys, starting at 0. #default_value to 0", | |
'#default_value' => 0, | |
'#options' => array( | |
0 => "key: 0", | |
1 => "key: 1", | |
'a' => "key: a", | |
'b' => "key: b", | |
), | |
'#description' => "<strong>BAD</strong>: 0 and alpha radios have 'checked' attribute, last one appear as selected", | |
); | |
$form['mixed_default_false'] = array( | |
'#type' => 'radios', | |
'#title' => "Mixed numeric & alpha keys, starting at 0. #default_value to FALSE", | |
'#default_value' => FALSE, | |
'#options' => array( | |
0 => "key: 0", | |
1 => "key: 1", | |
'a' => "key: a", | |
'b' => "key: b", | |
), | |
'#description' => "GOOD: no radio selected", | |
); | |
$form['alpha_default_zero'] = array( | |
'#type' => 'radios', | |
'#title' => "Only alpha keys. #default_value to 0", | |
'#default_value' => 0, | |
'#options' => array( | |
'a' => "key: a", | |
'b' => "key: b", | |
), | |
'#description' => "<strong>BAD</strong>: every radios have 'checked' attribute, last one appear as selected", | |
); | |
$form['alpha_default_false'] = array( | |
'#type' => 'radios', | |
'#title' => "Only alpha keys. #default_value to FALSE", | |
'#default_value' => FALSE, | |
'#options' => array( | |
'a' => "key: a", | |
'b' => "key: b", | |
), | |
'#description' => "GOOD: no radio selected", | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment