Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    May 2003
    Location
    Chicago, IL
    Posts
    131
    Thanks
    3
    Thanked 0 Times in 0 Posts

    jQuery star rating plugin question

    I'm using this star-rating plugin http://www.fyneworks.com/jquery/star-rating/ and the call back function provided to allow for submission of forms onclick of rating star.
    Code:
    $(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
    Code:
    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.
    Last edited by hothousegraphix; 01-10-2009 at 05:38 PM.

  • #2
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    You're still experiencing the problem?

    It seemed you're no longer using this code on the page you've linked to us:
    Code:
    $(document).ready(function() { 
    	$('form.entry_rating').rating( { 
    		callback:function(value, link) { 
    		alert(value);
    		}
    	});
    });
    ...you're already using this:
    Code:
    $(document).ready(function() { 
    
    	$('.auto-submit-star').rating( { 
    		callback:function(value, link) { 
    		this.form.submit();
    		}
    	 
    	});
    	
    });
    Let us know if I miss something else.
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #3
    Regular Coder
    Join Date
    May 2003
    Location
    Chicago, IL
    Posts
    131
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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.


  •  

    LinkBacks (?)


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •