Graddit presents new widgets for polls that you can build into your blogs and sites. Here's a simple poll example:
Number of options and text can be changed. Take code from graddit page, options are set like this:
{[['Bad',' | '],['Average',' | '],['Awesome']]}, where ' | ' are the separators between options; number of options should match the number that is passed to the script as a parameter (3 in this example).
I can be not just text, but any HTML valid element. For example, images:
Who rocks?
And of course general polls. How do you like the new widgets?
{[['Bad',' | '],['Average',' | '],['Awesome']]}
Number of options and text can be changed. Take code from graddit page, options are set like this:
{[['Bad',' | '],['Average',' | '],['Awesome']]}, where ' | ' are the separators between options; number of options should match the number that is passed to the script as a parameter (3 in this example).
I can be not just text, but any HTML valid element. For example, images:
{[['',' '], ['',' '], ['']]}
And of course general polls. How do you like the new widgets?
{[['So so'],['Okay'],['Perfect']]}
Rate this posting:
You might like:
How to make star rating and poll in one post. I have star rating widget working and I want to add poll but it only shows stars.
ReplyDeleteAre you talking about single rating/poll or you want ratings and polls (with same options) appear on each post?
DeleteI want this widget http://www.graddit.com/ratings-widget and this widget http://www.graddit.com/polls-widget on each post.
DeleteWhen I install just one of them it works fine. When I try to install both of them just first work and second doesnt.
It is possible. Use this as a reference: http://pastebin.com/BVcbBxCY
DeleteWhat to remember:
- all IDs (for divs, ratings and polls) should be different, so you need to add a prefix;
- if you want to change number of questions in your polls (defulat is 3) do it before applying to real blog; this number is stored in the database the very first time you send a request and can't be changed later easily (currently).
Thanks. It works exactly as I wanted but only on my test blog or new blog.
DeleteOn my main blog there are two problems:
First is that when I check new template on preview, all previous stars votes are reset to 0.
Second is that on the poll there are only 3 answers. I wanted 6. On test blog or new blog when I put 6 instead of 3 it works but on my main blog there is still 3.
Is it possible to fix this?
> First is that when I check new template on preview, all previous stars votes are reset to 0.
DeleteThis can happen if you changed rating IDs that are passed to the server. Usually this ID are the post IDs that are passed right after number of stars in the parameters line (...rate/5/post.id...); for the ratings and polls to be on the same page you had to add a prefix, so the IDs changed and ratings numbers dropped. If you'll keep IDs the same for ratings and polls there will be a conflict. There's no workaround for this. The good news: it will work in future the way you want.
> poll there are only 3 answers. I wanted 6
There are 3 answers for all posts that called polls code at least once; the initial number of "stars" (questions if talking about polls) is saved and can not be changed later. The good news: it will work properly for all your new posts and for all old posts that were not yet displayed to anybody with 3 questions. What is your blog address?
http://mlodewino.blogspot.com/
DeleteI'm not good at this. Do I really need to add prefix to IDs? Can you check it for me?
This is my old template with star ratings and with working old votes.
http://pastebin.com/s3ruWmvE
(highlighted lines 1098-1104)
and this is new template which reset all previous votes (when I check new template preview)
http://pastebin.com/kA4xg1VW
(highlighted lines 1100-1113)
How should I change it to save previous votes?
To save old ratings in the second template in line 1108 where's the call http://www.graddit.com/rate/eng/5/rating_... just remove "rating_" and leave it like http://www.graddit.com/rate/eng/5/... - that should make the trick.
DeleteThanks again. It's working. I will not use it because there still less then 6 answers in polls in older posts and I can't change it. But maybe it will be helpful for others.
DeleteNow when I know your blog address I can fix that for you and make it 6 answers for old posts if you want.
DeleteIf this is not a big problem I would be grateful if you fix that.
DeleteUpdated to 6. If you still see 3 this is cached version, it will update after some time or when somebody votes.
DeleteThis comment has been removed by the author.
DeleteThanks. Now It all works:)
DeleteThere was little issue with non-breaking space and whole template didnt work: "The entity "nbsp" was referenced, but not declared"
Here is solution if someone need it:
http://pastebin.com/7mGSZJzq
This comment has been removed by the author.
ReplyDeleteAnswers to the question in my poll are in digital form. Can I calculate and display the average of these numbers?
ReplyDeleteFor example, "Choose the number:" 1 (2) | 2 (0) | 3 (2) | 4 (0) | 5 (0) | 6 (1)
Average of the selected numbers is: 2.8
Use ...&callback=myFunctionThatDoesTheStuff&... parameter and do what you need in that JS function.
DeleteHello. Please, can I simply reset all the ratings in my blog ?
ReplyDeleteArnaud
Two questions:
Delete- by reset you mean drop everything to zeros (views, votes, etc.) or you have some issues with polls/ratings conflict and want to resolve it (as you're writing into polls topic)?
- which blog?
Yes I mean drop everything to zeros. I had conflicts too, but I relsoved it by erasing articles and creating new articles.
DeleteMy blog is in french : http://quelleestladifference.blogspot.fr/ It is about the differences between similar ideas.
Ok, I also see that you tried both: thumbs up/down and 5-stars. Which one you want to keep? I can transform them all to one form.
DeleteI wish to keep thumbs up/down please. It would be wonderful !
Delete(If it is not difficult, could you reset the thumbs up/down too ? Currently, almost all the votes are mine and they are not relevant.)
DeleteDropped everything. If you don't see the changes it's probably caching, it will fix in few hours. Also if you're using tops widget it will be showing the old data for a while.
DeleteThank you very much !
DeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDelete