How to make a poll

Paraphrased from the original (ok, mostly copied!):

http://blog.discourse.org/2015/08/improved-polls-in-discourse/

:star2: Here’s how it works :star2:

Single (default)

The simplest poll you can make is a single choice poll.

You just need a list surrounded by the [poll] BBCode tag [/poll].

[poll]
- Option A
- Option B
- Option C
[/poll]

This will produce the following poll:

  • Option A
  • Option B
  • Option C

0 voters


Multiple

If you want to allow multiple choices, you only need to add “type=multiple” to the tag, like so:

[poll type=multiple]
- Option A
- Option B
- Option C
[/poll]

This will produce the following poll (note the help text)

  • Option A
  • Option B
  • Option C

0 voters

Multiple (with options)

If you want to limit the number of selected options in a multiple choices poll, you can do so using both “min” and “max” arguments:

[poll type=multiple min=1 max=2]
- Option A
- Option B
- Option C
[/poll]

This will produce a multiple choice polls allowing up to 2 different options:

  • Option A
  • Option B
  • Option C

0 voters


Number

This 3rd type of polls comes from one of our customers. It can be used when you want to grade or rate something.

If you use the following syntax:

[poll type=number min=1 max=10][/poll]

It will automatically generate a list of numbers from “min” to “max”, and the result of the poll is the average of all of votes:

[poll name=number type=number min=1 max=10][/poll]

Number (with options)

You can use the “step” argument if you want to reduce the number of generated numbers

[poll type=number min=1 max=10 step=2][/poll]

[poll type=number min=1 max=10 step=2][/poll]

Customization ( :warning: deprecated :warning:)

By default, polls are using the colors of your forum theme. But you can override both the text and background colors.

Text color

Customizing the text color of the options is as easy as setting the “color” argument:

[poll color=red]
- Option A
- Option B
- Option C
[/poll]

Will produce this poll with red text:

  • Option A
  • Option B
  • Option C

0 voters

Background color

The background color can be customized using the “background” argument:

[poll background=#3f96ca]
- Option A
- Option B
- Option C
[/poll]

Will produce this poll with blue background:

  • Option A
  • Option B
  • Option C

0 voters

With content

Polls also support inside contrnt like links and emojis

[poll name=with_content]
- A link to [discourse](www.discourse.org)
- Emoji: :smile: 
[/poll]

Will produce this nice poll

0 voters


Multiple polls in the same post

Have you noticed that this post contains several polls? Wonder how’s that possible? It’s because I’m using a different “name” for each of the polls :wink:

[poll name=single]
- Option A
- Option B
- Option C
[/poll]
1 Like