It's pretty gool! 2008/7/13 Diego A. <[EMAIL PROTECTED]>:
> Hi JB, > > Thank you for spotting this problem and posting back with the solution. > I've added this fix to the plugin and will publish it on Monday (when I > have FTP access). > > Cheers, > Diego A. > > 2008/7/9 JB <[EMAIL PROTECTED]>: > > >> I figured this out, just in case anyone else has the same problem. >> The issue revolves around brackets [ ] not being allowed in css class >> names. >> >> The plugin takes the name of the field and uses it to generate a class >> name of the form "star_group_yourfieldnamehere" so with a rails form >> field, you'd end up with a class name like: >> >> star_group_mymodel[myfield] >> >> which is an illegal css class name. I fixed this by changing the >> following code: >> >> var n = this.name; >> >> to this: >> >> var n = this.name.replace(/^(.*?)\[(.*?)\]$/, "$1_$2"); >> var real_n = this.name; >> >> this removes the brackets and makes rails form names appear like >> mymodel_myfield instead of mymodel[myfield]. I defined real_n so that >> it can still be used for the hidden field. Works like a charm now! >> >> On Jul 9, 9:58 am, JB <[EMAIL PROTECTED]> wrote: >> > Hi - >> > >> > I'm trying to use the excellent star rating plugin from fyneworks >> > (http://www.fyneworks.com/jquery/star-rating) with a rails project I'm >> > working on. I'm running into a bit of an issue that I wonder if >> > anyone else has seen. >> > >> > Typical names of form fields in a rails app look something like this: >> > >> > mymodel[myfield] >> > >> > which I suspect is causing an issue with this plugin. If I leave the >> > form as generated by rails, with names like above, then the mouseout >> > and click events don't behave properly. mouseout doesn't remove the >> > stars the way it should, and clicking on a star only highlights the >> > star you clicked on, instead of all the stars before it also. >> > >> > If I manually hack the form names to be regular names, like "myfield" >> > instead of "mymodel[myfield]" then it works perfectly, but of course >> > then rails won't process my form correctly because the names aren't >> > right. >> > >> > Has anyone else run into this kind of problem? Any solutions anyone >> > can think of? I tried going through the plugin code, but I'm afraid >> > my jQuery-fu isn't where it needs to be to spot the problem. >> > >> > Any help is greatly appreciated.....thanks! >> > > > > -- > Cheers, > Diego A.