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
;>))