I have a Fivestar field with the "rated while editing" widget. I have selected the "Allow users to cancel their ratings" option. The X icon shows up next to the stars, but when you click it nothing happens. There is no way to cancel your rating.

The other widgets work correctly.

-Cameron

Comments

markwittens’s picture

Same problem here

greg_meszaros’s picture

StatusFileSize
new3.01 KB

Hi,

I checked and i found the issue in fivestar.js file under /js folder.

Try to change this bit of code:
rate: function(event) {
var $this = $(this);
var $widget = event.data;
var value = this.hash.replace('#', '');
$('select', $widget).val(value).change();
var $this_star = $this.closest('.star');
$this_star.prevAll('.star').andSelf().addClass('on');
$this_star.nextAll('.star').removeClass('on');
event.preventDefault();
},

to this:
rate: function(event) {
var $this = $(this);
var $widget = event.data;
var value = this.hash.replace('#', '');

$('select', $widget).val(value).change();

// Cancel rating
if (value == '0') {
$this.closest('.cancel').addClass('star');
var $this_star = $this.closest('.star');
$this_star.nextAll('.star').removeClass('on');
$this.closest('.cancel').removeClass('star');
}
else {
var $this_star = $this.closest('.star');
$this_star.prevAll('.star').andSelf().addClass('on');
$this_star.nextAll('.star').removeClass('on');
event.preventDefault();
}

},

Maybe this is not the best solution, it was just my quick one, but it's solving the problem, and maybe it should be commited to next dev??

I have attached my changed fivestar.js file too.(rename .txt to .js!)

Greg

kaptenkolja’s picture

Version: 7.x-2.x-dev » 7.x-2.0-alpha2
Status: Active » Patch (to be ported)

I have the same problem. Adding this comment to use in creating a patch. Don't know if I'm tagging this correctly though.

kaptenkolja’s picture

StatusFileSize
new675 bytes

Attaching patch.

emilymoi’s picture

Same problem and #4 works great. Thanks.

Plazmus’s picture

I confirm, same issue resolved with #4 patch.
I wonder why it hasn't been committed yet?

jibize’s picture

Version: 7.x-2.0-alpha2 » 7.x-2.x-dev
Issue summary: View changes
Status: Patch (to be ported) » Reviewed & tested by the community

Patch still applies cleanly on latest dev, and it does solve the problem with the Cancel button not clearing the stars on a "rated while editing" widget.

Thanks kaptenkolja!

whiteph’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.