SPFx – Quick Poll

Introduction

This component is developed as a SharePoint Framework web-part to create poll, capture response from the user’s and to display the results in a graphical view. This quick poll is very easy to maintain and quick to set up. The list ‘QuickPoll‘ which captures all the question and responses will be created automatically.

Features

  • Easy to setup with most of the configurations are optional.
  • Flexible to use without any critical configuration.
  • More than one poll questions can be added.
  • Schedule the poll questions in advance using the date parameters.
  • Option to choose the poll that has to be visible to the end users.
  • Poll response can be viewed via graphical representation as charts.

Properties

  • Display poll based on date – This property will check for the ‘Start Date’ and ‘End Date’ on the poll questions to display the correct poll question to the end user. The ‘Start Date’ and ‘End Date’ on the poll question will be enabled only when this property is turned on.
  • Poll Questions – Manage the collection of poll questions and choices.
    • Question Title – Title of the question.
    • Choices – Choices separated by comma.
    • Multi Selection – Whether the users are allowed to choose one or multiple.
    • Start Date – Date when the end user can start seeing the poll question.
    • End Date – Last day of the poll question visible to the end user.
  • Success Message – Message to be displayed to the user after successful submission. It is optional, if not provided the default message ‘Thank you for your submission‘ will be displayed.
  • Response Message – Message to be displayed to the user with the user response, once the user has submitted. It is optional, if not provided the default message ‘You Voted For: User Response‘ will be displayed below the chart.
  • Submit button text – Text to be displayed on the submit button. It is optional, if not provided the default text ‘Submit Vote‘ will be displayed.
  • Preferred Chart Type – Chart type to display the overall response for the question.

Note:

  • Poll questions with the same ‘Start Date’ and ‘End Date’ will follow the sort order to display the latest question to the end user.
  • Once the user started to response to the poll, do not delete the question from the question collection. All the questions are mapped based on the ID auto generated. It cannot be recovered once deleted.
  • Make sure the Multi Choice option is chosen wisely, do not change once the user started to response to the poll.

Preview

Source Code

The above web-part is shared with the community and is of free to use. Please click the below link to download the code and have fun.

https://github.com/pnp/sp-dev-fx-webparts/tree/master/samples/react-quick-poll

Happy Coding…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s