Advanced ranking poll works well when the behavior is set to Borda count (Ranking Poll) and Instant-runoff (Ranking Poll), but the vote is not saved when the behavior is set to Borda count drag and drop (Ranking Poll) and Instant-runoff drag and drop (Ranking Poll).

UPDATE: I'm investigating this further with a clean install and it appears to be related to the jquery: it works with jquery 1.5, but not 1.7. Unfortunately, I need to use 1.7 for my theme. I will continue to investigate, but if anyone has ideas about what has changed between 1.5 and 1.7 that would cause the draggable advanced ranking poll not to save the vote, I would appreciate your response.

Comments

tchase’s picture

Issue summary: View changes

I found the problem: As of jQuery 1.6, the .attr() method returns undefined for attributes that have not been set. To retrieve and change DOM properties such as the checked, selected, or disabled state of form elements, use the .prop() method. (source: https://api.jquery.com/attr/). This required changes to the following lines in advpoll-ranking.js -

        // update the select menu
-        $row.find("select option[value='" + (j) + "']").attr('selected', 'selected');
+        $row.find("select option[value='" + (j) + "']").prop('selected', 'selected');

        // remove attributes from the elements that aren't selected
-        $row.find("select option[value!='" + (j) + "']").removeAttr('selected');
+        $row.find("select option[value!='" + (j) + "']").removeProp('selected');