5 Replies Latest reply: Sep 13, 2012 6:50 AM by David_Powers RSS

    Some assistance with Spry Rating Widget

    WolfShade Community Member

      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,

       

      ^_^

        • 1. Re: Some assistance with Spry Rating Widget
          mytaxsite.co.uk CommunityMVP

          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-framework-availability.htm l>

           

          Good luck.

          • 2. Re: Some assistance with Spry Rating Widget
            WolfShade Community Member

            Thank you, but I am aware that Adobe has stopped supporting Spry.  I've already read the announcement.  But I still see the occasional Spry-related questions around here, so assumed that a Spry developer might have an answer to my query.

             

            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.

             

            ^_^

            • 3. Re: Some assistance with Spry Rating Widget
              mytaxsite.co.uk CommunityMVP

              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.

              • 4. Re: Some assistance with Spry Rating Widget
                WolfShade Community Member

                Thank you, mytaxsite.co.uk.  I'll repost in there and wait.

                 

                ^_^

                 

                UPDATE: Well, I would have posted, there, but it is now READ ONLY. 

                • 5. Re: Some assistance with Spry Rating Widget
                  David_Powers CommunityMVP

                  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).