0

Our customer wants to have this plugin within drupal: http://www.fyneworks.com/jquery/star-rating/#tab-Testing and I cannot get it to work.

The basic code works, I can create stars and have them display a stored value. However, I want to use the callback functionality and this is not working, not even when I copy the test code from the site above to a blank page.

There are no stars (just radiobuttons), when I add star as a class I can see the stars again but then the callback will not work (as mentioned on several pages).

I figured it might have something to do with the version of jQuery so I installed the jQuery Multi module and the most recent jQuery (1.7.2) and enabled that for the star rating plugin, but this did not help. Any tips on how to proceed/debug?

I am no jQuery expert, I tried looking at the plugin code to see if something was missing, but could not understand it and nobody else complains about this not working (except if they did something wrong with the callback functionality).

edit: I failed to mention that the entire page is constructed from php ignoring drupal things like blocks or nodes, this makes it hard to use the 5-star module. This was not my choice and a very bad way to use drupal, but that is what I have to work with, unfortunately.

  • you might have a look at the Fivestar module. – AjitS Jun 22 '12 at 7:08
  • Thanks for your suggestion, unfortunately I think this will not work as someone has decided to ignore the drupal structure, so I do not have nodes to work with. Sorry I forgot to mention this. – Rhand Jun 22 '12 at 7:16
  • In that case yore lost here. – niksmac Jun 22 '12 at 7:20
  • Why? It is possible to use jquery plugins in drupal, is it not? – Rhand Jun 22 '12 at 7:35
1

With help from Lennert at gettingsocial.nl I was able to solve this. The trick was to not use the drupal method to load the jquery.rating.pack.js as the script needs to be loaded after the checkboxes have been added. (the drupal_add_js() function will put it in the header).

0

You can use Fivestar module.

It features:

  • jQuery rollover effects and AJAX no-reload voting
  • Configurable star sets
  • Graceful degradation to an HTML rating form when JavaScript is turned off
  • Support for anonymous voters
  • Spam protection to keep users from filling your DB with bogus votes
  • Easy-to-use integration with Views module for lists sorted by rating, or filtered by min/max ratings
  • A Fivestar CCK field for use in custom node types
  • An easy-to-use Form API element type for use in other modules
  • Compatible with all versions of jQuery (1.0 - 1.4.4)

Dependencies

This module is dependent on the Voting API. Voting API provides database storage of votes, as well as Views integration. You'll need to download Voting API, and Views is highly suggested if you want to create pages of results or use ratings to sort content.

  • Thanks for your suggestion, unfortunately I think this will not work as someone has decided to ignore the drupal structure, so I do not have nodes to work with. Sorry I forgot to mention this. – Rhand Jun 22 '12 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.