Getting value of C Star Rating

Hi guys,

I’m trying to impliment a star rating system for my website by implementing the following code:

$this->widget(‘CStarRating’,array(‘name’=>‘rating’));

Everything’s working fine and nicely, but i need to store the value into my database and have no idea how to extract/retrieve the value the user selected. I tried searching thru google and apparently no one’s asking such a retarded question such as i, could any pros out there enlighten me? =[

I’ll probably retrieve the value from cstarrating and from my database, find the average and update back into the database, unless there’s a built in function in yii which im unaware of o.o

Thanks in advance!

Cheers,

JingXuan

CStarRating displays a star rating control that can collect user rating input.

CStarRating is based on jQuery Star Rating Plugin. It displays a list of stars indicating the rating values. Users can toggle these stars to indicate their rating input. On the server side, when the rating input is submitted, the value can be retrieved in the same way as working with a normal HTML input. For example, using




$this->widget('CStarRating',array('name'=>'rating'));


we can retrieve the rating value via $_POST['rating']. 




http://www.yiiframework.com/doc/api/1.1/CStarRating

Hey guys I am also working on CStarRating widget I am getting data from database and I am using as follow :


$review = Reviews::model()->findAll();

		foreach($review as $review)

		{

		   $rate=$review['rating'];

		   $this->widget('CStarRating',array(

				'name'=>'rating',

				'minRating'=>1,

				'maxRating'=>5,

				'starCount'=>5,

				'value'=>$rate,

				'readOnly'=>true,

			));

			echo "<br/>";

			echo $review['title'];

			echo "<br/>";

			echo "<font color='brown'>".ucfirst($review['name'])."</font><br/>";

			echo $review['body'];

			echo "<hr/><br/>";

		}

	?>

but when I get first data then result is ok as attached in 1.jpg

3738

1.jpg

and when I get second data then both the rating star collasp as in 2.jpg,

3739

2.jpg
what should I do in this case ?

hey guys I only get a radio buttons when i bring in the widget. what am I doing wrong pls?

&#036;this-&gt;widget('CStarRating',array('name'=&gt;'rating')); 

I am also using the foundation3 extension for my content and i call this widget within that widget. dont know if that might affect each other

$form=$this->beginWidget(‘foundation.widgets.FounActiveForm’, array(‘id’=>‘product-form’));

&#036;this-&gt;widget('CStarRating',array('name'=&gt;'rating'));

$this->endWidget();

thanks for any help.

Hi Friends,

see this

http://www.yiiframework.com/forum/index.php/topic/43947-cstar-rating/page__p__208389__fromsearch__1#entry208389