When I use the comment widget to rate nodes out of the core comment modul and set the fivestar comment settings to "Require Rating", it is still possible to submit a comment without rating.

Is there a fix for this bug? Perhaps it is only a problem with the 6.x-1.12 Version.

Comments

No fix for this bug? Any help is appriciated. Forcing user to give a vote while commenting is important for a simple review system with fivestar.

Best Regards

That's because of:

<?php
  $options
= array('-' => t('Select rating'));
?>

in fivestar.module.
Sign '-' lets a vote be valid.

It's strange fivestar_validate() should handle this sutuation but it never runs.

Hi vladimir,
thanks for your help.

That's because of:

<?php
  $options
= array('-' => t('Select rating'));
?>

in fivestar.module.
Sign '-' lets a vote be valid.

What does that mean? Is there a way to fix this?

I'm searching the way.
It seems fivestar_validate() should definitely do that but it doesn't.

StatusFileSize
new1.12 KB

I think I've found the issue in fivestar.module:
Before:

<?php
$element
['#validate']['fivestar_validate'] = array();
?>

After:

<?php
$element
['#element_validate'] = array('fivestar_validate');
?>

The origin is http://api.drupal.org/api/file/developer/topics/forms_api_reference.html...

The patch is not fully tested.

Status:Active» Needs review

code needs review

StatusFileSize
new1.1 KB

Rerolled patch. Replaced $form_state with $element.

Status:Needs review» Fixed

Thanks vladimir! Nice catch, a lingering piece of un-upgraded code from the D5 version.

Title:"Requiered Rating" does not work"Required Rating" does not work

Status:Fixed» Closed (fixed)

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