jQuery star rating problem with brackets []
If you used the star rating plugin of jQuery in cakePHP, you might experienced that the hover effects are not working properly. This is because one of the class name used to identify the buttons uses the radio button name. This will be a problem in cakephp because we use brackets in names.
In order to fix that, we need to remove them. Here is quick fix. Open file
from (line 97):
to:
from (line 108):
to:
I have reported this in the bugtracker and I hope it will be included in the next release.
<input type="radio" name="data[Model][field]" class="star" />
In order to fix that, we need to remove them. Here is quick fix. Open file
jquery.rating.js:
from (line 97):
// grouping: var n = this.name;
to:
// grouping: var real_name = this.name; var n = real_name.replace(/[^A-Za-z0-9_\-]/g, '-'); // remove unwanted characters
from (line 108):
$.rating.groups[n].valueElem = $('<input type="hidden" name="' + n + '" value=""' + (settings.readOnly ? ' disabled="disabled"' : '') + '>');
to:
$.rating.groups[n].valueElem = $('<input type="hidden" name="' + real_name + '" value=""' + (settings.readOnly ? ' disabled="disabled"' : '') + '>');
I have reported this in the bugtracker and I hope it will be included in the next release.
Tags: bug fixes, jQuery, star rating


![[Bloglines]](http://cakephp.prometsupport.com/wp-content/plugins/bookmarkify/bloglines.png)
![[del.icio.us]](http://cakephp.prometsupport.com/wp-content/plugins/bookmarkify/delicious.png)
![[Facebook]](http://cakephp.prometsupport.com/wp-content/plugins/bookmarkify/facebook.png)
![[Google]](http://cakephp.prometsupport.com/wp-content/plugins/bookmarkify/google.png)
![[MySpace]](http://cakephp.prometsupport.com/wp-content/plugins/bookmarkify/myspace.png)
![[Newsvine]](http://cakephp.prometsupport.com/wp-content/plugins/bookmarkify/newsvine.png)
![[Squidoo]](http://cakephp.prometsupport.com/wp-content/plugins/bookmarkify/squidoo.png)
![[StumbleUpon]](http://cakephp.prometsupport.com/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Technorati]](http://cakephp.prometsupport.com/wp-content/plugins/bookmarkify/technorati.png)
![[Twitter]](http://cakephp.prometsupport.com/wp-content/plugins/bookmarkify/twitter.png)
July 29th, 2008 at 12:31 am [...] Promet CakePHP Source» Blog Archive » jQuery star rating problem with brackets [] Handy, I was about to implement this in a soon to be released project (tags: cakephp jquery star rating) Posted by Richard@Home Filed in 15 [...]
August 5th, 2008 at 9:22 am Looks like your bug report has been dealt with. I downloaded the latest version of the jquery.rating.js and it has your suggested fix in place.
August 14th, 2008 at 11:02 pm thanks for the update Richard!