How to Create Polls

Creating a poll

The easiest way to create a poll is to use the poll builder. The poll builder can be accessed from the :gear: in the topic composer, and allows you to make a poll without needing to know the exact syntax.


Manually creating a poll

To create a poll surround a markdown list with [poll] and[/poll]

[poll]
- option one
- option two
- option three
[/poll]

or

[poll]
* option one
* option two
* option three
[/poll]

or, for numbered options—

[poll]
1. option one
2. option two
3. option three
[/poll]

Any of the above create the following result:

  1. option one
  2. option two
  3. option three

0 voters


You can also make a poll with multiple choices. Simply add type=multiple to the opening tag like so:

[poll type=multiple]
- option one
- option two
- option three
[/poll]

This creates the following result:

  • option one
  • option two
  • option three

0 voters

To limit the number of choices (or set a minimum), add min=X and/or max=Y

[poll type=multiple min=2 max=2]
- option one
- option two
- option three
[/poll]

This creates the following result:

  • option one
  • option two
  • option three
  • option four

0 voters

Polls can even include images! When including images in polls you may wish to adjust the image size to avoid overly large images.

[poll type=regular]
* ![image|690x458,50%](upload://2u570X7kQiPJQaJD1Bd8MLDHDNB.jpeg)
* ![image|690x334,50%](upload://35fmeFw8RMywSxIc4lbCb8UHPaT.jpg)
* ![image|690x499,50%](upload://xSDkRwmuj1pNc2QXKzthfXRlwsX.jpg)
[/poll]
[poll type=regular]
* Cat: a small domesticated carnivorous mammal with soft fur, a short snout, and retractile claws.
![image|690x458,50%](upload://2u570X7kQiPJQaJD1Bd8MLDHDNB.jpeg)
* Dog: a domesticated carnivorous mammal that typically has a long snout, an acute sense of smell, and a barking, howling, or whining voice.
![image|690x334,50%](upload://35fmeFw8RMywSxIc4lbCb8UHPaT.jpg)
* Fish: a limbless cold-blooded vertebrate animal with gills and fins and living wholly in water.
![image|690x499,50%](upload://xSDkRwmuj1pNc2QXKzthfXRlwsX.jpg)
[/poll]

0 voters


For a numbered poll, enter the following:

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

Which produces:

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

0 voters

You can also have it increment the numbers in steps using step=X

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

Which produces:

  • 2
  • 4
  • 6
  • 8
  • 10

0 voters


If multiple polls are used in a single post (like this one!) be sure to give each poll a unique name, or they will not work. Do this by adding name="poll_name" as a parameter.

[poll name="poll_1"]
1. option one
2. option two
3. option three
[/poll]

[poll name="poll_3" type=multiple min=2 max=3]
- option one
- option two
- option three
- option four
[/poll]

[poll name="poll_5" type=number min=2 max=10 step=2]
[/poll]

Lastly, any poll can have the voters made “public” by adding public=true to the parameter list.

[poll public=true]
- Yes
- No
- Maybe
[/poll]

Do you like polls?

  • Yes
  • No
  • Maybe

0 voters

18 Likes

2 posts were split to a new topic: Automatically close a poll on a given date/time?

Is it possible to create a multiple question poll in a topic and make it mandatory to respond to each question?

The poll that you have above, numbered from 1-10 goes on to two lines. 8, 9, and 10 are on the second line. How do you make all the values only appear on one line?

It is wrapping due to space constraints… it can’t fit on a single line.

Is there a way to make the text or spacing smaller?

Probably, using CSS.

Love the polls!

As a poll-creator, is it possible for me to download the raw data from a poll?

For example, I posted a poll to Pivotal’s internal forum to which people can respond with a number one through twenty. I can see the average response, but am more interested in the raw responses in order to produce a histogram, examine the range, etc.

Not currently, no. Discourse polls are intentionally “simple”, and are not meant to be used for data analysis like that. An admin could likely query the data via the Data explorer plugin, but an end user cannot.

To obtain data like this, we recommend using a full featured poll system, not Discourse polls.

2 Likes

Can we put together a Data Explorer example query for this?

2 Likes

Sure, adding to my list.

Looks like @gerhard already wrote one, and it still works. See Is it possible to see who voted in polls?. Note that you’ll need the post_id of the post that contains the poll. To obtain the post_id you’ll need to look at the json of the topic. Append .json to the end of the URL. For example, the post_id of this post can be found at https://meta.discourse.org/t/how-to-create-polls/77548.json (and is 424951). The post_id of the first post in this topic is 368654.

5 Likes

Is there a way to allow visitors vote without logging in?

No there is not. To prevent duplicate entries accounts are required. If you need anonymous polls I’d suggest an external service like https://www.strawpoll.me/

2 Likes

Is there any way to sort topics/organize topics based on poll data?

For example, our forum has a unique topic created for hundreds of exam questions. In each topic, we want to create a poll with three options: Easy, Medium, Hard.

Is there a way to sort the topics such that a user can do the easy ones first, and then medium ones, and then hard ones? Maybe by creating a dynamic tag that is dependent on poll data?

If anything like this is possible, would we need to have our topics set numerically (poll options are 1,2,3) or could we use qualitative options (easy, medium,hard).

Thanks so much!

There is no way to sort topics like this with native Discourse. To do so you’d likely need a custom plugin.

1 Like

Does the “Show who voted” toggle allow you to make it so folks can’t see the results? If not, what does that do?

I would like to create a poll and let people vote, but not let them see the results until after they have voted… and, of course, not allow them to change their answer. Is this possible with this simple Polling tool?

If You Dont Check that It wont show who voted

I think the answer to my original question is found in the “Results” section of the “Poll Builder”
Poll results can be viewed in the following ways:

  • Always Visible
  • On Vote
  • When Closed
  • Staff Only

The last two options are what I’m interested in. This is a great tool!

Joshua, feel free to add this GIF to your OP that shows all the options when creating a poll in Discourse:

Though I’m still unclear on the toggle that says “Show who voted.” I would assume it means by checking that, users would be able to see a list of who voted. Why not do a poll right here to test and see?

If I use the “Build Poll” feature and hit the “Show Who Voted” toggle then everyone will be able to see:

  • a list of everyone who participated, and how they voted
  • a list of everyone who participated, but not how they voted

0 voters

The results dropdown controls who can see the results, and when. Show who voted controls if those who can see the results can also see who voted for each option, versus just seeing the count of voters.

2 Likes