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.
- 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.
- 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.
- 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.
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.
12 thoughts on “SPFx – Quick Poll”
would this be compatible if deployed in SP2016?
Hi Denisse, the solution reference on the blog post points to the latest version which is only for SharePoint online (v1.11.0). But you can create a solution using 1.4.1 for SP 2016 and then you can replicate the code. It should work. Let me know if you encounter any issues.
I have tried this webpart in classic page. It is not working. It is working in modern site page only. Could you please tell me how to integrate this in classic page.
Hi, I haven’t tested in the classic page. Are you receiving any error? let me try it out and let u know.
Getting Config Your Poll screen after configured the Poll.
Error in Console: PnPjs is running in ie11 compat mode. Not all features may work as expected.
I am using Chrome browser only. But it is showing PnPJs is running in ie11 compat mode.
Hi Naresh, can you try the recommendation from the link https://pnp.github.io/pnpjs/concepts/polyfill/. Meanwhile I will troubleshoot and let u know the outcome.
Ok. It will be more helpful if the poll is run on classic pages. Please check and let me know.
Sure. Give me some time, will update you once verified.
Hi Sudharsan, Thank you for this quick poll, it works great !! (Using in O365)
just an update/fix, I have to update below code in getAllUsersResponse Method.
currentPollResponse: usersResponse.Response ? usersResponse.Response : usersResponse.MultiResponse.join(‘,’)
currentPollResponse: filRes.Response ? filRes.Response : filRes.MultiResponse.join(‘,’)
Else, it gives always the first person response in “You voted for: ”
Once again thanks!
Hi Rishi, thanks for the info. I will update and commit the code to the repo asap. Let me know if you have any clarifications.
Hi I am trying to run the command npn-install but getting errors
Hi, you can send me the info to firstname.lastname@example.org email address.