Voting

Summary: Add a form to record "votes" on a page
Version:
Prerequisites:
Status:
Maintainer: Pm
Categories: Voting Markup Forms

Questions answered by this recipe

How can I enable simple per-page voting, similar to what is done in PITS?

Description

The voting.phpΔ recipe provides a simple (:vote:) markup that can be used to allow people to cast and record "votes" in that page.

This is a "naive" mechanism for tallying votes from users, similar to what is done in PITS. The script defines a (:vote:) markup that displays a simple ballot form like the one below. Users can use this form to cast a "vote" which is then appended to any existing votes listed after the keyword "Votes:" within a page.

Votes: 0354501441345023542010335255055553202405020550152255505145555505555555554
Add a vote: Low High

The default uses the digits 0-5 for different levels of voting; wiki administrators can modify the script to substitute alternate prompts, values, and voting schemes.

Notes

This system only works well if the voters are somewhat honorable. First, there's nothing to prevent a voter from casting a whole bunch of votes. And although edit privileges are required to cast a vote (the voter is prompted for the edit password if needed), this also means that the voter has the ability to alter the current tally of recorded votes.

Hey, I did say that this script was naive. More complex recipes are possible if anyone wants to write one.

Comments/Feedback

  • this is a proposal: the votes are probably stored in 1 page variable. What about another 5 variables e.g. vote1, vote2, ..., vote5 where the vote weight are stored (appended) and the resulting variable "vote" is the result of concatenation of vote5...vote1. Thus the displayed votes could be 55331 instead of 15335 and the descending sorting by "votes" can give a better nformation. Jiri February 01, 2007, at 08:38 AM
  • I clicked on the Vote button out of curiosity and noticed that my named appeared as someone who modified the page in the recent changes. This means that someone also would be able to track who voted what way by lining up the recent changes with the order of the votes, or possibly the page history. So, it's not exactly anonymous voting either. JohnCooley? November 09, 2005, at 04:12 PM
  • 5 options is probably good enough, but if the votes were recorded using a delimted value then it could handle any values. As is you could not have the voting record 10 or higher accuratly. JohnCooley? November 09, 2005, at 04:12 PM
  • Is there any way to take the average of all the numbers and just show the one average vote? Also, is there a way to display the average graphically, like a 5-star rating?

See Also

Contributors

  • Pm, 2004-12-02