CStarRating bug? - shows radio group instead of stars if callback set

hey, guys,

I don’t know if it is a bug or if I’m doing something wrong, but when I register the ‘callback’ property for the CStarRating widget, Yii generates a radio group instead of stars.

The code:

$this->widget(‘CStarRating’,

    array('name'=>'rating',


          'readOnly' => false,


          'value' => $review->rating,


          'starWidth' => 30,


          'titles'=>array(1=>'weak',2=>'so so',3=>'good',4=>'thats great',5=>'the best'),


          'maxRating'=>5,


          'allowEmpty'=>false,


          'focus'=>"function(value, link){


                    var tip = $('#hover-test');


                    tip[0].data = tip[0].data || tip.html();


                    tip.html(link.title || 'value: '+value);


                    }",


          'blur'=>"function(value, link){


                   var tip = $('#hover-test');


                   $('#hover-test').html(tip[0].data || '');


                   }",


          'callback'=>'function(value, link){alert(value);',

));

The result:

<span id="rating" name="rating">

<input id="rating_0" value="1" title="weak" name="rating" type="radio">

<input id="rating_1" value="2" title="so so" name="rating" type="radio">

<input id="rating_2" value="3" title="good" name="rating" type="radio">

<input id="rating_3" value="4" title="thats great" name="rating" type="radio">

<input id="rating_4" value="5" title="the best" name="rating" type="radio">

</span>

If I remove the callback property, things work well and I get:

<span id="rating" name="rating">

<input name="rating" value="" type="hidden"><div class="star star_group_rating star_live"><a title="weak">1</a></div>

<div class="star star_group_rating star_live"><a title="so so">2</a></div>

<div class="star star_group_rating star_live"><a title="good">3</a></div>

<div class="star star_group_rating star_live"><a title="thats great">4</a></div>

<div class="star star_group_rating star_live"><a title="the best">5</a></div>

</span>

I really appreciate your help

;>))

anybody, please?

For additional info, version is 1.0.7.

thanks again

Your callback function has syntax error.

You’re right…my bad…thank you very much Qiang

It was missing a "}"

‘callback’=>“function(value){alert(value);}”));

could you please change the title of this topic from

CStarRating bug? - shows radio group instead of stars if callback set

to

CStarRating shows radio group instead of stars if callback set ?

I think that the word “bug” doesn’t sound good because the problem was my javascript code, not Yii

sorry about that…

regards

:>))