Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In a selection voting, Randomize answers order is checked and users can select maximum 2 out of 5 choices.
If a user checks 3 choices, an error is raised: 3 choices were selected but only 2 are allowed (as expected).
The problem is that the order of answers is changed/randomized, but the checked fields remain the same, resulting in other selections than originally choosen.
IMO randomize should not occur in case an error is raised, leaving the answer and checks as they were.
Comment | File | Size | Author |
---|---|---|---|
2_selection_after_error.gif | 14.19 KB | floater | |
1_initial_selection.gif | 13.27 KB | floater |
Comments
Comment #1
kayceedub CreditAttribution: kayceedub commentedThis problem actually runs deeper and its actually a pretty serious problem. It looks like the only thing that is being randomized is the display text for the choices. The actual values are still listed as non-randomized, which is why the above poster is seeing the problem above.
When you submit the ballot, what is actually submitted are votes for the non-randomized choices that would've appeared if the display text/labels for the checkboxes were not randomized. Does that make sense?
Comment #2
Robert_T CreditAttribution: Robert_T commentedThis is a bug in the /modes/selection module, a component of decisions, within function decisions_selection_voting_form(). The checkboxes' labels are randomized, but the checkboxes' values are always output in numeric order (1,2,3,...). This is due to the use of the $node->choice array index instead of the $node->choice[index]['vote_offset'] in the $list array used for $form['choice']['#options'].
The solution is a small modification to /modes/selection.module. The code below begins at line 219 of the 2011-Feb-25 version of 6.x-1.x-dev.
Comment #3
travisjbennett CreditAttribution: travisjbennett commented(Follow)
Comment #4
travisjbennett CreditAttribution: travisjbennett commented(retracted)
Comment #5
travisjbennett CreditAttribution: travisjbennett commentedLooks like this change fixed the issue with radio buttons (THANK YOU!), but we're still only half way there.
1-click forms, or forms with checkboxes (used when the voter isn't limited to only one selection) still have this issue. The code for that is right above the area Robert_T fixed, but I'm having some trouble figuring out how to make a similar change.
I'm using version module 6.x-1.7.