Set readonly attribute at server side

Jul 30, 2012 at 1:00 AM
Edited Jul 30, 2012 at 1:10 AM

Hi, first of all great plugin! It saved me a lot of work. Have a bit trouble at start trying to get it working with AJAX but got it working.

Now I'm building a movie website where users can register, after that users can post comments, rate movies, etc

Now how would I set the readonly attribute via PHP server side? Because I need to check if the user has already rated a movie (update/reset rate will be for the near future :) )

Thanks in advance.

 

Though of changing style attribute display to none (<div class="rateit-reset" style="display: none;"></div>) because you do this in your example page.


Coordinator
Jul 30, 2012 at 9:20 AM
Edited Jul 30, 2012 at 9:20 AM

 

I don't really know PHP, but since we are talking about a client side technology, the resides on the client side.

I guess that you are looping in php over a recordset with movies, and next to each movie want to place a rateit control.
Currently I guess you are simply writing:
<div class="rateit" />

You should replace this with something like this (I don't know PHP , so I'm not sure if this is the correct syntax):

<div class="rateit" <?php echo ($hasvoted == 'true' ? 'data-rateit-readonly="true" data-rateit-value="' . $ratevalue .'"') ?> />

Jul 30, 2012 at 11:08 AM

Just what I needed thanks!

Coordinator
Jul 30, 2012 at 2:17 PM

Great. 

you could also add the data-rateit-ispreset="true" attribute. This gives the star an orange color (if you use the default stars), and gives the user an indication that he already voted on that one.

Gidon