views:

1677

answers:

4

I was introduced to the Star Rating widget for jQuery UI: http://orkans-tmp.22web.net/star_rating/ I was originally using this one: http://www.fyneworks.com/jquery/star-rating/

Is there any difference between using the two?

Well trying to use the jquery UI one, I can't get the input buttons to show up as stars. I have these js and css files included:

<script src="jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
<script src="ui.stars.js" type="text/javascript"></script>
<link href="ui.stars.css" type="text/css" rel="stylesheet" />

And for my code, simply:

<form>
    Rating: <span id="stars-cap"></span>
    <div id="stars-wrapper1">
     <input type="radio" name="newrate" value="1" title="Very poor" />
     <input type="radio" name="newrate" value="2" title="Poor" />
     <input type="radio" name="newrate" value="3" title="Not that bad" />
     <input type="radio" name="newrate" value="4" title="Fair" />
     <input type="radio" name="newrate" value="5" title="Average" checked="checked" />
     <input type="radio" name="newrate" value="6" title="Almost good" />
     <input type="radio" name="newrate" value="7" title="Good" />
     <input type="radio" name="newrate" value="8" title="Very good" />
     <input type="radio" name="newrate" value="9" title="Excellent" />
     <input type="radio" name="newrate" value="10" title="Perfect" />
    </div>
</form>

All the files and images are in the same folder. I've never used jquery UI before, so I'm not sure if all I need is that file. I'm not sure if it needs it either, the other star rating plugin I was using didn't require it. Anyone know what I'm missing anything?

A: 

usually jquery ui css files refer images from folder named images put is same directory as css file. So you need to either change path of refered images in ui.stars.js.

  |
  --images
     |
     ---image files are here
  |
  --ui.stars.css
TheVillageIdiot
Weird, I created the images folder and put the ui.stars.gif inside but still no luck.
Roger
A: 

When using orkans' star_rating you need to tell it to convert radiobuttons to stars explicitly, like this (I use jQuery.noConflict mode):

jQuery(document).ready(function($){
  $("#stars-wrapper1").stars();
}
Artem Vasiliev
A: 
Francesco
A: 

I found out, that problem with the versoion I have downloaded is, that object o is not initialized ok in the _init function (the defaults from the end of ui.star.js are not loaded). This object also sets the CSS values (classes). I haven't found the solution yet, but a simple workaround would be, to fill those values at initialization of stars on your page:

  <script type="text/javascript">
    $("#stars-wrapper1").stars({
    cancelClass: "ui-stars-cancel",
    starClass: "ui-stars-star",
    starOnClass: "ui-stars-star-on",
    starHoverClass: "ui-stars-star-hover",
    starDisabledClass: "ui-stars-star-disabled",
    cancelHoverClass: "ui-stars-cancel-hover",
    cancelDisabledClass: "ui-stars-cancel-disabled"
    });
  </script>
the berserker