Provides the ability to access and render a poll.

The polls object allows you to select a specific poll or poll placement:

<div>
{% assign poll = polls["Poll Name"] %}
<h4>{{ poll.question }}</h4>
{% for option in poll.options %}
<div>
<input type="radio" name="{{ poll.name }}" id="{{ option.id }}" />
<label for="{{ option.id }}">{{ option.answer }}</label>
</div>
{% endfor %}
<button type="button">{{ poll.submit_button_label }}</button>
</div>

Polls Attributes

placements

Returns the pollplacements object.

[poll name or id]

You can access any poll by its Name or Id properties.

{% assign poll = polls["Poll Name"] %}

{% assign poll = polls["41827a5c-33de-49b8-a0c7-439e6a02eb98"] %}

Poll Placements Attributes

[poll placement name or id]

You can access any pollplacement by its Name or Id properties.

{% assign placement = polls.placements["Placement Name or Id"] %}

{% assign placement = polls.placements["7677c5d4-406e-4b6c-907c-916ac17dba0f"] %}

Poll Placement Attributes

name

Returns the Name field for the poll placement.

placement_url

The URL that can be used to retrieve the poll placement fully rendered by a template.

polls

Returns the collection of poll objects associated with the placement.

Iteration tags and array filters may be used with this collection.

random_url

The URL that can be used to retrieve a random poll from the placement fully rendered by a template.

submit_url

The URL to which a completed poll is submitted.

Poll Attributes

has_user_voted

Returns true if the current user (logged in or anonymous) has already voted in this poll.

name

Returns the Name field for the poll.

options

Returns the collection of polloption objects associated with the poll.

Iteration tags and array filters may be used with this collection.

poll_url

The URL that can be used to retrieve the poll fully rendered by a template.

question

Returns the Question field for the poll.

submit_button_label

Returns a string that can be used to override the submit button label for the poll.

submit_url

The URL to which a completed poll is submitted.

user_selected_option

Returns the polloption object selected by the user (if they have already voted).

votes

Returns the number of votes that have been tabulated for the poll.

Poll Option Attributes

answer

Returns the Answer field for the poll.

percentage

Returns the percentage of votes in the poll for the option as a decimal number between 0 and 100.

votes

Returns the number of votes that have been tabulated for the option.