...

View Full Version : jQuery star rating plugin question



hothousegraphix
01-09-2009, 05:56 PM
I'm using this star-rating plugin http://www.fyneworks.com/jquery/star-rating/ and the call back function (http://www.fyneworks.com/jquery/star-rating/#tab-Testing) provided to allow for submission of forms onclick of rating star.


$(document).ready(function() {
$('form.entry_rating').rating( {
callback:function(value, link) {
alert(value);
}
});
});

However, once the callback is included I get an error I've been trying to track down for the past day and a half.

In IE the error thrown is "Object doesn't support this property or method" on Line 100 character 4.

In my JS debugger the plugin breaks on line 99


var n = (this.name || 'unnamed-rating').replace(/\[|\]/, "_");

I would guess that for some reason the form class is not being passed but I'm not sure about this. I can't us ID as my key because this is dynamic and always changing.

I can definitely say this is related to the callback function because when it is not included no errors occur. I've tried re-naming the form referenced in the function in a multitude of ways none of which seems to have had any affect.

Any advice would be welcome.

Thanks.

rangana
01-10-2009, 08:06 AM
You're still experiencing the problem?

It seemed you're no longer using this code on the page you've linked to us:


$(document).ready(function() {
$('form.entry_rating').rating( {
callback:function(value, link) {
alert(value);
}
});
});


...you're already using this:


$(document).ready(function() {

$('.auto-submit-star').rating( {
callback:function(value, link) {
this.form.submit();
}

});

});


Let us know if I miss something else.

hothousegraphix
01-10-2009, 04:37 PM
Sorry...I ultimately found the solution to the trouble I was experiencing late last night.

Unfortunately, the docs provided with the plugin do not elaborate on the specific usage of the "callback" and exactly how to implement.

It turns out that the "class" referenced is not to the form containing the "radio" buttons, but rather the radio button group itself. Additionally, there is no flexibility in naming. The class called must be the ".auto-submit-star" class shown in the example.

Easy to understand once you're aware of these particulars but clearly this is just one more case of poor documentation; too many assumptions made about what people will take away from the information provided.

I appreciate you taking the time to look at my post.

Thanks much!

Regards.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum