Submission Confirmation Behavior
- HST Behavior class: com.onehippo.cms7.eforms.hst.behaviors.ConfirmationBehavior
- CMS Plugin class: com.onehippo.cms7.eforms.cms.extensions.ConfirmationPlugin
Introduction
The Submission Confirmation pluggable behavior sends a confirmation message to an e-mail address entered in the form.
The table below lists all the behavior's configuration fields available in the document editor, each with a description and the JCR property used to store the field's value in the form document.
Field | Description | JCR Property |
---|---|---|
Send e-mail |
A confirmation e-mail is only sent if this checkbox is checked. This way the confirmation behaviour can be added to a Form document type by default, but editors can decide per form document if the mail will be sent or not. |
eforms:confirmationenablesending |
Select any e-mail text field |
A checkbox list of all text fields in the form that have the validation rule "E-mail Address" configured. The CMS user can check any field in the list for which the entered e-mail address should receive a confirmation message. Note: when adding a new e-mail field to the form, the checkbox list is updated only after saving the form. |
eforms:confirmationemailfields |
Subject | The subject line of the confirmation message. If not filled in, it defaults to 'Confirmation of receipt', a value that is localized by a properties file. |
eforms:confirmationsubject |
Text | An optional paragraph of text that may be added to the confirmation message. |
eforms:confirmationtext |
Include form data | A checkbox that defines whether the filled in form field values are included in the confirmation message. |
eforms:confirmationincludefields |
'Reply-To' e-mail address | The optional reply-to e-mail address of the confirmation message. You can enter just the full e-mail address but also the standard notation ' MySender<[email protected]>'. If not filled in, it defaults to the values as configured by component parameters 'eforms-from-name' and 'eforms-from-email'. |
eforms:confirmationreplytoaddress |
The standard confirmation message consists of the form name, the optional text paragraph and the optional enumeration of all form fields and their entered values. The standard message can be overridden by introducing a Freemarker or Velocity mail template in the site.
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.ConfirmationPlugin
- mode = ${mode}
- wicket.id = ${cluster.id}.extensions.item
- wicket.model = ${wicket.model}
Screenshot:
Add at least one text field with a e-mail address validation rule to your form(s). One or more of these fields can then be selected as the destination address(es) of the confirmation email.
Make sure that at least one of the used e-mail address fields is a required field, otherwise a user can submit the form without supplying any destination address for the confirmation e-mail.
Note: Instead of adding the plugin to the default eforms: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 parameters to the component configuration:
- behaviors = com.onehippo.cms7.eforms.hst.behaviors.ConfirmationBehavior
- eforms-mailsession = mail/Session (depends on your environment)
Screenshot:
You can also configure certain e-mail headers using the following optional component parameters (if not provided, your mail server will use default values):
- 'From' header:
- eforms-from-email
- eforms-from-name
- 'Sender' header:
- eforms-sender-email
- eforms-sender-name
Demo
The Enterprise Forms demo contains a form that has the confirmation behavior plugged in.
- CMS: http://localhost:8080/cms/?path=/content/documents/hippoaddoneformsdemo/forms/pluggedin-form
- Site: http://localhost:8080/site/pluggedin