If I create more choices using the Add Choice link (JavaScript enabled), these extra choices are not visible anymore after I click Preview. They also disappear from the edit form, so a subsequent Submit of the form will only have the first 5 choices in the Poll.
Not using Preview is OK, then all 5+ choices get saved.

This patch seems to fix the problem by updating the edit-choices hidden field when Add Choices is clicked. But since the regular Submit code seems to handle it OK, maybe its better fixed at another place (by having advpoll_form() ignore $_POST['choices'] but use length($_POST['choice']) instead or something)?

--- advpoll/advpoll-form.js (revision 191)
+++ advpoll/advpoll-form.js (working copy)
@@ -107,6 +107,7 @@
newChoice.find("input").val("").end().insertBefore("#more-choices").fadeIn();
// Update hidden form values
$("#edit-changed").val($("#edit-changed").val() + 1);
+ $("#edit-choices").val(parseInt($("#edit-choices").val()) + 1);

Drupal.advpoll.removeChoiceClick();
Drupal.advpoll.maxChoices(numChoices);

Comments

anders.fajerson’s picture

Status: Active » Closed (duplicate)