If a user tries to rate the same number of stars as their previous rating, they receive this message. For example they’ve already voted 4 stars but clicks 4 stars accidentally, the message “An illegal choice…” appears.

Comments

rferguson created an issue. See original summary.

Seyedmostafa’s picture

Any progress for this issue? As it persist in the latest version too.

trishen’s picture

trishen’s picture

Status: Active » Needs review
Anonymous’s picture

Patch in #3 solved this issue for me.
Without the patch, double clicking would show the an illegal choice message and save a '0' value in the database for fivestar voting widget. With the patch, the message does not appear and no 0-values appear in the database.

bombjack’s picture

Status: Needs review » Reviewed & tested by the community

Patch in #3 works for me. As reported by others it removes the 'illegal choice' error when the user re-clicks on the same vote element / star.

bombjack’s picture

Version: 8.x-1.0-alpha4 » 8.x-1.0-alpha5

Sorry forgot to bump the version, since I have it working with the latest release.

shaundychko’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new528 bytes

I think the patch in #3 misses the root cause, which is that the javascript is adding an empty value to the list of possible values. The attached patch modifies the configuration option passed which allowed empty values. The patch changes this:

<select autocomplete="off" data-result-value="3" data-vote-value="3" data-style="fontawesome-stars-o" data-show-own-vote="false" data-drupal-selector="edit-value" class="form-select form-control" id="edit-value" name="value" style="display: none;"><option value=""></option><option value="1">Poor</option><option value="2">Not so poor</option><option value="3" selected="selected">average</option><option value="4">good</option><option value="5">very good</option></select>

to this:

<select autocomplete="off" data-result-value="3" data-vote-value="3" data-style="fontawesome-stars-o" data-show-own-vote="true" data-drupal-selector="edit-value" class="form-select form-control" id="edit-value--8CwNmyLBR9E" name="value" style="display: none;"><option value="1">Poor</option><option value="2">Not so poor</option><option value="3" selected="selected">average</option><option value="4">good</option><option value="5">very good</option></select>

Notice the empty option in the first.

sara.hussien’s picture

tr’s picture

Version: 8.x-1.0-alpha5 » 8.x-1.x-dev
Status: Needs review » Postponed (maintainer needs more info)

@sara.hussien: How is your patch different from #8 ? Please post an interdiff.txt and explain why a new patch is needed. Is there something wrong with #8? Do you disagree with #8 ?

loze’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

I have fixed this in a patch in another issue #2831545: Option to cancel vote