This is really a weird bug. It has 3 conditions and 1 event.

Conditions:
1) Search module is enabled
2) Poll module is enabled
3) Title must be missing or at most one choice must be entered on Create Poll form. (form must be invalidated)

Event:
1) Preview the poll

One invalidated form will be displayed right aligned in the header region and the other one will be displayed in the content area.

I looked into the codes of search.module and poll.module but couldn't find the reason.

My server configuration is:
IIS on WinXP, PHP 5, MySQL 5

CommentFileSizeAuthor
#4 84111_form.inc_r1.150790 bytesAjK
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TheoRichel’s picture

I have the same problem on an Apache server, PHP 4, Mysql 3.2x

AjK’s picture

Whacky bug this one.

If you also enable the search field in the theme header you get even more spectacular results! (3 poll forms, one "blows away" the header section)

It seems that when the search module is filling content areas it's getting back from the forms API the poll.modules error form instead. Investigating now

AjK’s picture

More info....

Actually, when a poll form submission fails at the required Question field being empty, any call to drupal_get_form() will return the poll's error form.

I can reproduce this by creating a block. Use the PHP input filter, create some like the following:

<?php
function no_function() {
  return '';
}

$temp = drupal_get_form("no_function");
error_log(print_r($temp, TRUE));

?>

Then enable the block somewhere on your site. The contents of $temp, when examined, is the poll's complete error form.

So this error isn't unique to the search.module, it'll happen to anything that calls drupal_get_form() when the poll form has failed validation. It shows up most on search.module just because it attempts to render a form in a block or in a theme's header which is common on alot of sites.

AjK’s picture

Priority: Normal » Critical
FileSize
790 bytes

Thanks to Eaton's help on IRC we have a patch. Raising this to critical as #multistep forms are broken in HEAD

AjK’s picture

Title: Poll submission form displayed twice » #multistep forms broken

Could do with a better name for this issue now we know what it is

AjK’s picture

Status: Active » Needs review
eaton’s picture

Status: Needs review » Reviewed & tested by the community

Tested this on my box. The problem is easy to reproduce and easy to spot in the code when you know what you're looking for. Simple fix and absolutely essential.

drumm’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD.

Anonymous’s picture

Status: Fixed » Closed (fixed)