Poll macro
The Poll Smartlet enables you to integrate a poll within your site in just a few steps.
First, you must add a content item of contenttype Poll Question, which holds the definition of your poll: the question, the answers to choose from and whether or not multiple answers are allowed.
Then, you can use this poll from anywhere. Just add a call to the sml_Poll Smartlet or choose the poll option from the Configure Smartlet cms addin.
Example
The image below is an example of a multiple choice poll.
After voting, the result will be displayed. The image below is an example of the results displayed.
Parameters
The table below gives an overview of the available parameters for the Poll Smartlet.
Name | Type | Default | Description |
---|---|---|---|
pollItem | locator | None | Reference to an item containing the poll definition. |
pollFolder | locator | None | Reference to a folder containing one or more poll definitions. The currently active poll definition will be selected automatically*. |
allowAnonymous | boolean | true | Determines if anonymous users are allowed to vote. |
allowPreview | boolean | false | Determines if previewing the result without voting is allowed (if true, a Preview button will be displayed). |
allowVoteAfterPreview | boolean | false | Determines if an user is allowed to vote after previewing the results. |
* The currently active poll is defined as the poll item within the given folder with the most recent Show From date that is still active.
Technical details
The Poll Smartlet uses the table swtUserItemFeedback to store (and retrieve) the results. This table is also used by other Web Toolkit macros, however records related to the Poll macro will have the value "poll" within the Source column.
The Poll SXML macro is used internally. Within the sml_Poll() Smartlet several poll viper calls are used as well, such as poll.vote() and poll.getrelevantpoll().