Voting starts in March for the Drupal Association Board election.
The following FAPI code creates a set of radio buttons with none selected. If the user then submits the form without selecting an option, drupal outputs "An illegal choice has been detected. Please contact the site administrator." instead of "test is required". This error only happens when #required is set to TRUE.
$form['test'] = array( '#type' => 'radios', '#title' => 'test', '#options' => array( 0 => 'cat', 1 => 'dog', 2 => 'turkey', 3 => 'chicken', ), '#required' => TRUE, );
Doing a little digging, it seems that #needs_validation is only set to TRUE when #required is set to TRUE (As #value is apparently not set if not value is posted), which is why the error only happens when #required is set.
I have no idea how to go about fixing this, but it works as expected in Drupal 6, so I'd say this is a regression.
FAILED: [[SimpleTest]]: [MySQL] 39,267 pass(es), 3 fail(s), and 0 exception(s). View
PASSED: [[SimpleTest]]: [MySQL] 39,262 pass(es). View
PASSED: [[SimpleTest]]: [MySQL] 37,111 pass(es). View