I have Drupal 7.15 installed.
I am using panels to build my site - so my poll node is rendered using panel.
If I don't select any of the choices and press the vote button, I get this error:

An illegal choice has been detected. Please contact the site administrator.

Instead of the normal:
Your vote could not be recorded because you did not select any of the choices.

Any idea why this might be happening?

#5 1823906-5-poll-illegal-choice.patch1.12 KBrahulbile
PASSED: [[SimpleTest]]: [MySQL] 39,323 pass(es).
[ View ]


Project:Drupal core» Panels
Version:7.15» 7.x-3.x-dev
Component:poll.module» Miscellaneous

This could be an effect from panels, have you asked them?

I also faced the same issue with poll module. I think the issue is not because of the panels module. I faced the issue with out panels.

I think issue is due to #default_value set to -1 for $form['choice'] inside function poll_view_voting() at line 723 in poll module . When form is being build by drupal's form api there is a check that #default_value should be one from the options for that form element.

In your custom module you can fix it by implementing hook_form_FORM_ID_alter as below

function MYMODULE_form_poll_view_voting_alter(&$form, &$form_state, $form_id) {
        // Unset the default value which is causing issue
        // Define custom validate function to apply the validation
$form['#validate'][] = 'MYMODULE_form_poll_view_voting_validate';
function MYMODULE_form_poll_view_voting_validate($form, &$form_state){
  if (!isset($form_state['values']['choice'])) {
    form_set_error( 'choice', t('Your vote could not be recorded because you did not select any of the choices.'));

Project:Panels» Drupal core
Version:7.x-3.x-dev» 7.15
Component:Miscellaneous» poll.module
Issue summary:View changes

Seems to be a poll issue - not a panels issue.

Assigned:Unassigned» rahulbile
Status:Active» Needs work

Assigned:rahulbile» Unassigned
Status:Needs work» Needs review
new1.12 KB
PASSED: [[SimpleTest]]: [MySQL] 39,323 pass(es).
[ View ]

Attached is the patch against 7.x.

Version:7.15» 7.x-dev