Fox Voting

Summary: examples of using Fox for voting, polling and making choices
Version:
Prerequisites: pmwiki 2.2.0 beta
Status:
Maintainer: HansB?
Categories: CMS PIM Voting Fox

Description

Some examples of using Fox for voting, polling and making choices.

Voting List

This is an example of a voting list, listing the names of people in the column they voted for.
The source markup below will produce a three column list with names, who have posted their vote (name) to the question: "Are you coming to my birthday party?"

Are you coming to my birthday party?

Please type in your name in the box, click the appropriate button and click Enter
(:fox form1:)
(:input text author {$Author} size=20:)
||width=80%
||I am coming: (:input radio foxplace vote1 checked:)|| 
||I am not coming (:input radio foxplace vote2:)|| 
||Perhaps (:input radio foxplace vote3:) ||(:input submit post "Enter":) ||
(:foxtemplate "||{$$author} ||(:if author {$$author}:){[foxdelline]}(:if:) ||":)
(:foxend form1:)
(:table width=100%:)
(:cell:)
!!!!People coming
(:foxprepend form1 vote1:)
(:cell:)
!!!!People not coming
(:foxprepend form1 vote2:)
(:cell:)
!!!!People perhaps coming
(:foxprepend form1 vote3:)
(:tableend:)

Note that I am using also a custom conditional, defined like this in config.php:

 # add conditional markup: (:if author AUTHORNAME:)
$Conditions['author'] = "\$GLOBALS['Author']==\$condparm";

This conditional is used to display a line delete link for the author only.

Multi-choice voting

This form uses check boxes to post the user's name in a table listing several options. The options are defined at the top in page text variables. A line delete button allows the user to delete the entry. A custom conditional is used to check author name against the author field. It is defined like this in config.php:

# add conditional markup: (:if author AUTHORNAME:)
$Conditions['author'] = "\$GLOBALS['Author']==\$condparm";

Form wiki code Note some lines are wrapped for easier reading!

!!Next meeting time proposal
(:Option1: Mon 11:00 :)
(:Option2: Tue 9:00 :)
(:Option3: Thu 10:00 :)
(:Option4: Thu 15:00 :)
(:Option5: Fri 11:00 :)

||width=100% border=0
||!{$:Option1}||!{$:Option2} ||!{$:Option3} ||!{$:Option4} ||!{$:Option5} ||
(:foxappend form1:)

Please  check the boxes you can manage, fill in your name, and click Submit.
(:fox form1 #append:)(:input default vote "":)
(:input hidden foxfields vote1,vote2,vote3,vote4,vote5 :)
(:foxtemplate "||{$$vote1} ||{$$vote2} ||{$$vote3} ||{$$vote4} ||{$$vote5} ||
(:if author {$$author}:){[foxdelline]}(:if:) ||":)
||width=100% 
||{$:Option1} (:input checkbox vote1 {$$author}:) ||{$:Option2} (:input checkbox vote2 {$$author}:) ||
{$:Option3} (:input checkbox vote3 {$$author}:) ||{$:Option4} (:input checkbox vote4 {$$author}:) ||
{$:Option5} (:input checkbox vote5 {$$author}:)  ||Name (:input text author {$Author} size=15:) ||
(:input submit post "Submit":) ||
(:foxend form1:)

Notes

Release Notes

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

Comments

  • PKHG? I added two || because on a beta63 two choices where not visible?

See Also

Contributors