Skip navigation
Currently Being Moderated

Some assistance with Spry Rating Widget

Sep 12, 2012 6:58 AM

Hello, everyone.

 

I have downloaded the Spry library from the repository, and am playing with it, trying to learn it.  So far, so good. 

 

I have written a page that is using both the Spry Accordion Panel (I have 8, so far) and the Spry Rating Widget (one in each panel.)

 

I am displaying (below the stars) a tally of ratings for each panel (I'm keeping track in an XML file.)  The 1-5 Star title, the number of times each is clicked, and a green bar (img) indicating percentage.

 

When a star is clicked, the XML is updated, but you have to refresh the page to see the new values.  How can I dynamically, and in real time, update the value display when a star is clicked?  (Once I have that, I can figure out how to dynamically change the img size/percentage.)

 

Thank you,

 

^_^

 
Replies
  • Currently Being Moderated
    Sep 12, 2012 7:19 PM   in reply to WolfShade

    Not sure whether you are aware that Adobe has stopped developing Spry and only the volunteers and enthusiasts will keep it going.  I would strongly, recommend that you should start using something else.  To read the Adobe Blog, click at this link:

     

    <http://blogs.adobe.com/dreamweaver/2012/08/update-on-adobe-spry-framew ork-availability.html>

     

    Good luck.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 12, 2012 8:35 PM   in reply to WolfShade

    Sure, SPRY is still supported but the experts are normally in this forum:

     

    <http://forums.adobe.com/community/labs/spry>

     

    Unfortunately, it is not very active. and so you will get some replies here; it is a question of waiting until Gramps is around

     

    Good luck.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 13, 2012 6:50 AM   in reply to WolfShade

    WolfShade wrote:

     

    And I'm just starting to learn it, just because.  It's something different.  I'll probably never use any of it in any paid projects, but it's still nice to get a feel for it.

    I have never used the rating widget, but I do have the Spry example files from when they were originally released. I assume that you have managed to download the same files from GitHub.

     

    Open widgets.html in the widgets folder. Scroll down to the bottom, and click the Ratings > Overview link. Close to the bottom is a section titled "Update the Ratings Value Dynamically". The example code looks like this:

     

     

    <body>
     <span id="spryrating1" class="ratingContainer">
    
     <span class="ratingButton"></span>
     <span class="ratingButton"></span>
     <span class="ratingButton"></span>
     <span class="ratingButton"></span>
     <span class="ratingButton"></span>
     <input type="text" id="ratingValue" name="dynamic_rate" value="2"/>
    
     </span>
    
    
    <script type="text/javascript">
     var rate = new Spry.Widget.Rating("spryrating1", {ratingValueElement:"ratingValue", afterRating:'serverValue', saveURL:'SpryRating.php?id=spryrating5&val=@@rw_Rating@@'});
    </script>
    
    </body>

     

    Notice that the options object contains this: afterRating: 'serverValue'. Unfortunately, the sample files (at least the ones I've got) don't include a copy of SpryRating.php. However, I assume that it probably saves the selected value, calculates the average of all saved values, and then uses echo to output "serverValue=4.5" (or whatever the average is).

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points