<divid="el"class="c-rating"></div><scriptsrc="http://www.cambridgedata.org/Testboard/manager/five-star-rating-master/js/dist/rating.min.js"></script><script>// target elementvar el = document.querySelector('#el');// current rating, or initial ratingvar currentRating =[@field:QA_Tester_Rating#];// max rating, i.e. number of stars you wantvar maxRating=5;// callback to run after setting the ratingvar callback =function(rating){ alert(rating);};// rating instancevar 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:
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
NikkiC
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:
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
Link to comment
Share on other sites
7 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.