Creating and managing polls

:bookmark: This guide explains how to create polls in Discourse to gather votes from users on any topic.

:person_raising_hand: Required user level: All users

:information_source: By default, polls are enabled in Discourse and users of trust level 1 or above are allowed to create them. Site admins can adjust who can create polls via the poll create allowed groups site setting and disable polls using the poll enabled site setting.

Creating a poll from the toolbar

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

To show advanced options press the :gear: icon. This will show you different poll options such as if the poll auto closes, set groups allowed to vote, choose bar or pie, etc.

Poll options

Poll type:

  • Single Choice: Default poll type. Users can select a single choice from the poll
  • Multiple Choice: Users can select multiple choices from the poll.
    • The poll creator must also define the minimum and maximum number of choices a user can make. By default the minimum will be 1, and the maximum will be the number of poll choices.
  • Number Rating: Users can select a single number.
    • The poll creator must also define the min, max and step for the number rating. For example, if the min is 2, the max is 10, and the step is 2, the options will be 2, 4, 6, 8, and 10.

Results:

  • Always visible: Default poll results. Users can always see the results of the poll, regardless of if they’ve voted.
  • Only after voting: Users must vote before they can see the results of the poll.
  • When the poll is closed: Poll results will only be revealed once the poll is closed.
  • Staff only: Only site staff will be able to see the poll results.

Allowed groups:

Allows the poll creator to limit which groups can participate in the poll. Users not in the listed groups will be able to view the poll, but not vote. Default is all users can participate, no group limitation.

Chart type:

For Single or Multiple Choice polls, choose whether to display the result in a bar graph or pie chart.

Show who voted:

Enabled by default, this allows those who can view poll results to also view the specific choices of each poll user. (Bar Chart type only)

Automatically close poll:

Allows the poll creator to set a date/time for the poll to close automatically. Unlike manually closed polls, auto-closed polls cannot be re-opened.

Including images

Polls can even include images! After using the poll builder to insert the poll, images can be uploaded to the post and manually added to the poll. Uploaded images should be small, or adjusted to display at a lower percentage:

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

Including relative dates

Polls can also include relative dates! In a similar way to adding images, after using the poll builder to insert the poll you can insert dates into the poll options via the “Insert date / time” composer button:

[poll type=regular]
* [date=2019-10-13 timezone="Europe/Paris"]
* [date=2019-10-12 timezone="Europe/Paris"]
* [date=2019-10-11 timezone="Europe/Paris"]
[/poll]
  • 2019-10-12T22:00:00Z
  • 2019-10-11T22:00:00Z
  • 2019-10-10T22:00:00Z
0 voters

Multiple polls in a post

If multiple polls are used in a single post (like this one!) each poll will need a unique name or they will not work. When using the poll builder each extra poll will be numbered sequentially, but you can also do this manually 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="dave" type=number min=2 max=10 step=2]
[/poll]

Manually creating a poll

While the poll builder is the easiest option, it is also possible to manually create and edit polls within the composer itself.

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

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

:information_source: Any markdown list will work, including using hyphens - or numbers instead of asterisks *.

This will create the following result:

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

To manually create more complex polls, additional parameters can be added to the poll tag. For instance:

[poll type=multiple results=on_vote min=1 max=2 public=true chartType=pie groups=trust_level_1 close=3024-12-31T00:00:00.000Z]
# Do you like polls?
* Yes
* No
* Maybe
[/poll]
Do you like polls?
  • Yes
  • No
  • Maybe
0 voters

(Though not all options will make sense for all polls :slight_smile:)

Using the poll builder is a great way to find out the format of these additional parameters for later use.

FAQs

Can anyone vote in a poll?

Even with no group voting restrictions on the poll itself, users must be able to reply to the topic where the poll is created in order to participate. Users with see only permissions will not be able to vote.

Can polls be edited?

All votes are cleared when a poll is edited, to ensure the poll creator can’t change the choices a user voted for. As such, by default polls can only be edited for a grace period of 5 minutes after being created.

:exclamation: Votes cannot be recovered once a poll is edited and the votes are cleared

Can I export poll data for further analysis?

Staff can use the Discourse Data Explorer to export poll data as a csv, which can be imported into the data analysis program of their choice.

Last edited by @hugh 2024-07-29T10:05:00Z

Last checked by @hugh 2024-07-02T09:50:57Z

Check documentPerform check on document:
「いいね!」 62

これは初歩的な質問かもしれませんが、質問があります。

例えば、投票を作成し、投票が投じられたらすぐに結果が表示されるように設定したとします。その後、投票が終了した後に結果の表示を設定すべきだったという間違いに気づきました。そこで、現在の投票を編集して、投票設定のギアアイコンからアクセスできるオプションの中から、その投票の表示を「常に表示」から「投票が終了したとき」に変更する方法はありますか?

それとも、この投票を削除して、新しい投票を開始し、「投票が終了したとき」という投票結果の表示設定を選択する必要がありますか?

スクリーンショットも添付します。

アドバイスをお願いします。

この投稿がこのトピックに該当しない場合は、モデレーター/管理者に適切なセクションに移動していただくようお願いいたします。

「いいね!」 1

投票を削除せずに変更できます。投稿を編集すると、投票は「[poll type=regular results=on_vote public=true chartType=bar]」のようなものから始まります。「results」パラメータを「results=on_close」に編集できます。
ただし、記憶が正しければ、投票を編集するとすべての投票は削除されますが、少なくとも再作成する必要はありません。

「いいね!」 3

その通りです。

このようなマイナーな変更のために、編集によってリセットが「強制」されるのではなく、リセットする「オプション」があれば、私にとってはより理にかなっています。

過去にこのような変更のためにデータベースをハッキングしたことがありますが(編集によるリセットを回避するため)、それは少し脆弱です。

「いいね!」 4

大変参考になりました。

もし、投票を作成した管理者が、投票に使用されているトピックを編集したところ、トピックの編集回数が上がるのではなく、下がるということがあった場合、お二人はどのように推測されますか?

私の推測では、投票が削除され、その後新しい投票が開始されたのではないかということです。これは、投票を行っているユーザーにとって、トピックの編集回数が下がることを説明できるでしょう。

例:
ユーザーは最初に投票にアクセスしました。その際、投票の設定は「常に表示」になっていました。その投票のトピック編集回数は4でした。

管理者に投票の設定が「常に表示」になっていることを指摘された後、ユーザーは投票の設定が「投票後に表示」になっている投票を目にします。しかし、トピック編集回数は3に下がりました。つまり、トピック編集回数は上がるのではなく、下がるのです。

私の考えでは、管理者が以前の投票を削除し、新しい投票を開始したということです。

「いいね!」 1

このドキュメントをランキング選択投票を含めるように更新することは可能でしょうか?具体的には、ラウンドがどのように、いつインクリメントされるかについてです。
皆さん、よろしくお願いします!

「いいね!」 5

もっともなご指摘です @meave

Ranked Choice投票の作成者ですが、これは私のミスです。

OP(元の投稿)の編集権限がありません。どなたかがこれをコピーして好きなようにフォーマットしてくれることを非常に嬉しく思います。または、Wikiに変換されれば喜んで貢献します。

現在は、ここで説明されているとおりに機能します。これは古典的なインスタントランオフ投票です。

(私の投票プラグインのフォークには、実際、単体テストとしてその例が含まれています!)

プロセスは次のとおりです。

すべての投票者は候補者の順序付きリストを提出します。各ラウンドでは、1位の候補者のみを考慮します(そして、潜在的な勝者と最悪の敗者に焦点を当てます)。

  1. 各候補者の1位票を数えます。
  2. 最も多くの票を獲得した候補者を見つけます。
  3. 明確で単一の過半数があるか確認し、見つかった場合は勝者として返します(これ以上ラウンドはありません、停止)。

ない場合:

  1. 最も少ない票を獲得した候補者を見つけます。
  2. すべての投票から最も少ない票を獲得した候補者を削除します。

投票がすべて空になった場合:

  1. 削除された候補者の引き分けを報告します(これ以上ラウンドはありません、停止)。

それ以外の場合:

  1. 各投票者にとって1位の候補者が敗者となった場合、2位の候補者がその投票者の1位の選択肢となるように、すべての投票を上にシフトします。

そして、過半数または引き分けが見つかるまでラウンドは続きます。

「いいね!」 6

@merefield さん、ありがとうございます!
まさに必要としていたものです!

「いいね!」 3

レポート作成目的で、異なるチャネルのすべての個々の投票結果をエクスポートすることは可能ですか?

「いいね!」 1

データエクスプローラーで実行できます。私はAIに次のように尋ねました。
「レポート目的で、データエクスプローラーを使用して、さまざまなチャンネルのすべての投票結果をエクスポートすることは可能ですか?」
そして、このクエリが返されました。

SELECT  
    p.topic_id, 
    p.name AS poll_name,
    o.id AS option_id, 
    o.html AS option_text, 
    COUNT(v.id) AS vote_count
FROM polls p
JOIN poll_options o ON p.id = o.poll_id
LEFT JOIN poll_votes v ON o.id = v.poll_option_id
GROUP BY p.topic_id, p.name, o.id, o.html
ORDER BY p.topic_id, p.name, o.id;

これは機能するかもしれませんか?

「いいね!」 1

@pfaffman

迅速なご返信とご協力、誠にありがとうございます!

来週中に試してみるつもりですが、おそらく休暇明けにならないと試せないと思います。

試せるようになったら、フィードバックをお返しします。

重ねて、本当にありがとうございます!

「いいね!」 1

投票について質問があります。

標準の外観よりも見栄えを良くするために、HTMLやCSSを使用することは可能ですか?

よろしくお願いします。

ブラウザのインスペクター(右クリックして「検証」)で試しましたか?そこでできれば、はい、可能です。

ただし、PollsはChart.jsを使用しているため、多くのベクトルベースの処理が行われます。

変更したい内容によって、本当に異なります。

「いいね!」 3

ランキング投票です。テキストが長すぎる場合、選択ボタンはテキストの左側に配置する必要があります。現在はテキストがボタンの下にあり、テキスト全体を右側に配置し、ボタンを左側のテキストに揃えたいと考えています。

皆さん、こんにちは。

投票で、例えば特定の選択肢を選んだ理由を説明するようなテキスト入力を、何らかの方法で含めることが可能かどうか、どなたかご存知ですか?

「いいね!」 1

「コメントを以下に」?

トピックでのコメント以外にはありません。

「いいね!」 1

なるほど。@merefield さん、ありがとうございます。投票結果と一緒にエクスポートできる書面でのフィードバックを取得しようとしていました。

「いいね!」 1


フィードに投票が表示されないのはなぜですか?クリックしたときにのみ表示されます。

「いいね!」 2

ああ、これは投票/トピックの抜粋の制限だと思います。現在、メインのトピック空間の外に表示させることはできないと思います。

「いいね!」 3

ご回答ありがとうございます!

「いいね!」 3