Submission Counter Behavior
- HST Behavior class: com.onehippo.cms7.eforms.hst.behaviors.FormSubmissionCounterBehavior
- CMS Plugin class: com.onehippo.cms7.eforms.cms.extensions.FormCounterExtensionPlugin
Introduction
The Submission Counter pluggable behavior adds a counter to a form. The counter is incremented on each form submission. In addition it provides the following functionalities:
- Form submission counter visible in form document in CMS
- Configurable maximum number of form submissions
- Configurable message to display once maximum has been reached
- Use custom number to increment counter on each form submission
- Use value of numerical dropdown field in form to increment counter on each form submission
- Combine with StoreFormDataPlugin: enabling the option "Use actual store data for counter". See Actual Store Counter for more detail.
Screenshot:
CMS Configuration
To add the CMS plugin to the form editor, add a node of type frontend:plugin under /hippo:namespaces/eforms/form/editor:templates/_default_. Add the following properties:
- plugin.class = com.onehippo.cms7.eforms.cms.extensions.FormCounterExtensionPlugin
- mode = ${mode}
- wicket.id = ${cluster.id}.extensions.item
- wicket.model = ${wicket.model}
Screenshot:
Note: instead of adding the plugin to the default ef:form template, you can also define your own custom form template and add the plugin there.
HST Configuration
To add the behavior to your form component, add at least the following parameter to the component configuration:
- behaviors = com.onehippo.cms7.eforms.hst.behaviors.FormSubmissionCounterBehavior"
Screenshot:
Request Attributes
This behavior implements DoBeforeRenderBehavior and sets the following request attributes:
- maxFormSubmissionsReached (boolean): indicated whether the maximum number of form submissions has been reached
- maxFormSubmissionsReachedText (String): text to display if maximum number of form submissions has been reached
Demo
The Enterprise Forms demo contains a form that has the submission counter behavior plugged in.