Search the Community
Showing results for tags 'star rating'.
-
Hi there, I'm trying to add a graphic star rating system to my site. I've found the following: http://callmenick.com/post/five-star-rating-component-with-javascript-css which gets me about halfway there, but I just need some slight modifications! This is what I have in my datapage so far: <div id="el" class="c-rating"></div> <script src="http://www.cambridgedata.org/Testboard/manager/five-star-rating-master/js/dist/rating.min.js"></script> <script> // target element var el = document.querySelector('#el'); // current rating, or initial rating var currentRating = [@field:QA_Tester_Rating#]; // max rating, i.e. number of stars you want var maxRating= 5; // callback to run after setting the rating var callback = function(rating) { alert(rating); }; // rating instance var myRating = rating(el, currentRating, maxRating, callback); </script> Where the field QA_Tester_Rating is the field in my table I want to read from and update using this system. At present, it reads from the field fine when there is something already in there, but if the field is blank, the stars don't show at all, so this is my first problem - I'd like the 5 stars to appear, empty, on the page when there is no rating yet. The second issue is that it's not updating my table. I tried adding something along these lines: document.getElementById("EditRecordQA_Tester_Rating").value=myRating; But my javascript is terrible and it obviously didn't work. Last issue, I would like to remove the popup alert when you change the rating. I thought it would be as simple as removing the bit that says: { alert(rating); } But that didn't work either! Any help you can give would be much appreciated! Nikki