Tutorials/Create a Poll
From WITTIE
Basic Usage
When creating a poll, there are only three things (parameters) that you have to specify: the question, a slug, and the options.
Parameters
| Parameter | Explanation |
|---|---|
| Question | The question can contain any character except " (double quote) or a line break. |
| Slug | The slug must be a word unique to each poll on the page. It can only contain letters and numbers, and must start with a letter. It can only be ONE word. |
| Options | Each option should be on it's own line. They can contain any character, but can not contain any special formatting. |
Example
| What it looks like: (click the box to see the poll question and options appear)
|
| What you type: |
<poll question="What is your favorite color?" slug="color"> Red Green Blue Purple Yellow </poll> |
Advanced Options
In addition to the three things you have to include with your poll, you can also choose to include other parameters. The table below lists the additional parameters that you can define for any poll you create. The first column lists the parameter name. The second column lists the default setting. The pole you create will default to this setting if you do not add code to the parameter to change the setting. If you wish to change the setting to something other than the default, you made add different code to that parameter listed under the explaination column. E.g. By default, polls are set to use a "type" of "qualitative." If you wanted that parameter to be "interval" instead, you would use type="interval" in the code for your poll.
Parameters
| Parameter | Default | Explanation |
|---|---|---|
| type | qualitative | Can be any of interval, ratio, or qualitative.
Interval is for numeric data with no natural zero, such as temperature. The response options will be numbered, beginning at 1. Ratio is for numeric data with a true zero, such as weight, length, duration, and most other physical properties. The response options will be numbered, beginning at 0. Qualitative is for data with no natural numeric equivalent, such as color or make of car. The response options will display as letters, beginning with A. |
| reverse | false | If this is set to true, or yes, or is just added, it will tell the system that the first option is the highest ranking option, otherwise the first is assumed to be the lowest (the default of false). Note: This only makes sense when used with type="interval" or type="ratio" |
| active | true | If set to false, or no, the poll will be closed and no responses will be able to be made. |
| showoptions | true | If set to false or no, options will not be displayed when the results are displayed. |
| anonymous | true | Whether or not to allow unregistered users to participate.
True means unregistered users will be allowed to participate. False means unregistered users will NOT be allowed to participate. They will only be able to view the results. |
| multiple | true | Whether or not to allow multiple votes from the same user. True means yes. False means no. If multiple attemps are not allowed, if a user has already voted, only the results will appear if they try to vote again. |
| width | 400 | The width of the voting box (in pixels). Can not be less than 350. |
Examples
Rate this Article
| What it looks like:
|
| What you type: |
<poll question="Please rate this article" width=600 slug="rate" type="interval" reverse active="false"> Awesome - Content and technical aspects were top notch. Impressive - Either content or technical aspects were top notch; or both aspects were pretty good. Not bad - Either the content or the technical aspects were pretty good. Still needs work - Both the content and the technical aspects need major improvements. </poll> |
What it does:
|
How many Siblings?
| What it looks like:
|
| What you type: |
<poll question="How many Siblings do you have?" width=350 slug="siblings" type="ratio" showoptions="false" multiple="false"> None One Two Three Four More than Four </poll> |
What it does:
|
First President
| What it looks like:
|
| What you type: |
<poll question="Pop Quiz: Who was the first president of the United States?" width=475 slug="president" anonymous="false"> Abraham Lincoln George Washington Barrack Obama Richard Nixon </poll> |
What it does:
|