eddysilvamendes / jquery-star-rating-plugin

Automatically exported from code.google.com/p/jquery-star-rating-plugin
0 stars 0 forks source link

doesn't work when the radio box was surrounded by <lable> #17

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

<label for="id_rating_0"><input value="1" type="radio" class="star-rating" 
name="rating" id="id_rating_0" /> </label> 
<label for="id_rating_1"><input value="2" type="radio" class="star-rating" 
name="rating" id="id_rating_1" /> </label> 
<label for="id_rating_2"><input value="3" type="radio" class="star-rating" 
name="rating" id="id_rating_2" /> </label> 
<label for="id_rating_3"><input value="4" type="radio" class="star-rating" 
name="rating" id="id_rating_3" /> </label> 
<label for="id_rating_4"><input value="5" type="radio" class="star-rating" 
name="rating" id="id_rating_4" /> </label> 

What is the expected output? What do you see instead?
these code above doesn't work with jquery star rating.

What version of the plugin/jQuery are you using?
PLUGIN VERSION:
jQuery Star Rating Plugin v3.00 - 2009-03-16
JQUERY VERSION:
1.3.2

On what browser(s) or operating system?
BROWSER(S):
chrome, firefox 3

Please provide a link to where the problem can be observed:
URL:

Feel free to provide any additional information below.

Original issue reported on code.google.com by ask...@gmail.com on 20 Mar 2009 at 3:46

GoogleCodeExporter commented 8 years ago
I can clearly see the problem but can you explain why you'd surround each radio 
box 
with a label without any text?

Original comment by diego.a...@gmail.com on 20 Mar 2009 at 4:30

GoogleCodeExporter commented 8 years ago

Original comment by diego.a...@gmail.com on 20 Mar 2009 at 4:31

GoogleCodeExporter commented 8 years ago
Hi diego,
these html code was the default output of django form widget. 
In fact there is text in label, i change it to empty string, otherwise it looks 
weird.
It will be great if this plugin can deal with the label tag (even with text).
Thanks.

Original comment by ask...@gmail.com on 20 Mar 2009 at 4:46

GoogleCodeExporter commented 8 years ago
Done. Try the latest version:
http://jquery-star-rating-plugin.googlecode.com/svn/trunk/jquery.rating.js

Original comment by diego.a...@gmail.com on 21 Mar 2009 at 2:53

GoogleCodeExporter commented 8 years ago

Original comment by diego.a...@gmail.com on 21 Mar 2009 at 2:54

GoogleCodeExporter commented 8 years ago
Thanks for your quick fix.
But it seems i can only rate 1?(r22)
Here is my test code.

<form onsubmit='
 $(this).after($(this).serialize()+"<br/>");
 return false;
 $("input",this).rating("readOnly",true);
 return false;
'>
 <label for="id_rating_0"><input value="1" type="radio" class="star 
{callback:function(){ this.form.submit() }}" 
name="rating" id="id_rating_0" /> 1 </label> 
<label for="id_rating_1"><input value="2" type="radio" class="star" 
name="rating" id="id_rating_1" /> 2 </label> 
<label for="id_rating_2"><input value="3" type="radio" class="star" 
name="rating" id="id_rating_2" /> 3 </label> 
<label for="id_rating_3"><input value="4" type="radio" class="star" 
name="rating" id="id_rating_3" /> 4 </label> 
<label for="id_rating_4"><input value="5" type="radio" class="star" 
name="rating" id="id_rating_4" /> 5 </label>  
 <input type="submit" value="Submit" />
</form>

Original comment by ask...@gmail.com on 21 Mar 2009 at 3:11

GoogleCodeExporter commented 8 years ago
I second this. without the <label> tag it is fine, however with this code 
doesn't
work in firefox 3.5.1. but does in IE 6, 7.

despite this - Great plugin - thanks for all the work!

Original comment by james.ol...@gmail.com on 20 Jul 2009 at 8:30

GoogleCodeExporter commented 8 years ago
I have the same structure - input inside label (standard form rendering in Zend 
Framework) and script from svn. The problem persist in Chrome v4.0.249.22 on 
Linux and 
Safari 4 on Windows (probably in all WebKit based browsers).
The problem is that I can only rate 1, no matter what star I click. All other 
browsers 
works perfect.

Original comment by Ischenk...@gmail.com on 6 Dec 2009 at 12:27

GoogleCodeExporter commented 8 years ago
Same here. Usign ZendFramework that renders the same output when I apply the 
stars
only the first star is available.
I did a quick workarround, just used the jquery unwrap to remove the labels 
before
apply the stars:
//Unwrap any element that "encapsulates" the selected element
//In our case the <label></label>
$('input.radio').unwrap();
$('input.radio').rating();

Hope this can help others.

Original comment by hand...@gmail.com on 10 May 2010 at 1:25

GoogleCodeExporter commented 8 years ago
Thanks "hand---@gmail"! This was driving me crazy, but your quick fix worked 
great.

Just a heads up, this is still an issue with Zend generated radios wrapped in 
labels in Safari.

Cheers

Original comment by thaddeu...@gmail.com on 2 Apr 2011 at 10:41

GoogleCodeExporter commented 8 years ago
$('input.radio').unwrap();
$('input.radio').rating();

The above lines have to be replaced by 
$('input:radio').rating();

It should work now.

Cheers.

Original comment by vi...@twelve77.com on 10 Aug 2012 at 11:58