Using Forms to Poll Users
In previous versions of Liferay, Site Administrators had access to a dedicated Polls application in the Site Administration → Content and Data menu. This application was deprecated in Liferay 7.3 and removed in Liferay 7.4.
Liferay Forms has been enhanced to fulfill the use cases that the Polls application handled in older Liferay versions. To create new polls, use Liferay Forms with the features described here.
If you’re upgrading along the path of Liferay 7.2 → 7.3 → 7.4, your Polls are automatically upgraded to use Forms.
A comprehensive listing of form settings is included in the Forms configuration reference.
Creating Polls
Three settings were added to the Form Settings modal, in the Submissions section, to enabled polls-like functionality in Liferay Forms: Limit to One Submission per User, Expiration Date, and Show Partial Results to Respondents.
Limit to One Submission Per User
Limit submissions to one per User. Do not allow multiple form submissions to logged in Users.
Enabling Limit to One Submission per User also requires that Users are authenticated to fill out the form. This requirement overrides the permissions set on the form and the form setting Require User Authentication: False.
When a user views the form after submitting, Liferay displays a message. For Liferay U49+/GA49+, you can customize the header and body content for this message. Otherwise, the default message appears:
Add an Expiration Date
By default, forms never expire. If you disable the Never Expire setting, you can then set the date when the form expires. After this date, no submissions are allowed. Form users see an expiration notification when accessing the form.
Show Partial Results to Respondents
Allow respondents to see aggregated data on the currently submitted form records. Respondents can view the current Forms Report data for the form. Enabling this warns the user against submitting sensitive information.
Creating a Poll with Liferay Forms
Use Forms-based polls to keep site visitors engaged with your site’s content.
Two applications make and display a poll: the Forms application in the Site Menu and the Form widget you add to a page.
-
From the Site Menu, go to Content → Polls.
-
Click the button and fill out the Title and Description.
-
Configure the form to behave like a poll: open the Form Settings window, got to the Submissions section, and
- Show Partial Results to Respondents: Enabled
- Limit to One Submission per User: Enabled
- Never Expire: Unchecked if desired (set the expiration date)
-
Now configure the poll question. Add a required multi-line Text field to the form.
- Label: How was your visit?
- Field Type: Multiple Lines
- Required Field: Enabled
-
Click Publish to make the form available to Users.
Forms are accessed by a direct link or by displaying the form on a Liferay page. See Publishing a Form for details.
Upgrading Polls to Forms
If you’re upgrading Liferay along the path of Liferay 7.2 → 7.3 → 7.4, your Polls are automatically upgraded to use Forms. During the 7.4 lifecycle the upgrade process to accomplish this task was enhanced; as of Liferay 7.4 GA/Update 27 it can now
- Convert the entities in the backend so that Polls become Form entities and can be managed with the Forms application and APIs.
- Enable the form settings that provide polls-like behavior.
- If the Poll was displayed on a page in the Polls Display widget, post-upgrade it’s displayed on the page in a Form widget.
For installations upgraded to Liferay 7.4 versions prior to DXP Update 27/CE GA 27, the upgrade process was incomplete. To fully upgrade the Polls you must
- make sure that the Limit to One Submission per User setting is configured in the form.
- manually replace any Polls Display widget you had on a page with a Form widget.