Configure the FormDataStore Layer
Introduction
Goals
Configure Enterprise Forms' temporary form data storage layer used to support the Post/Redirect/Get pattern.
Background
Enterprise Forms support the Post/Redirect/Get pattern for form submissions. Posted form data are temporarily stored before the Redirect to make them available for retrieval in the Get stage. This temporary storage is handled by a FormDataStore layer for which different storage backend implementations are available.
Available FormDataStore Implementations
All implementations implement the com.onehippo.cms7.eforms.hst.formdatastore.FormDataStore interface.
The following implementations are available out-of-the-box:
- com.onehippo.cms7.eforms.hst.formdatastore.RepositoryFormDataStore (default)
Uses the HST facility to store form data in the content repository below the /formdata node. - com.onehippo.cms7.eforms.hst.formdatastore.CachingFormDataStore
Stores form data in memory. Optionally, it can use a cookie to save the formMap id, instead of the u_u_i_d render parameter.
Configure the FormDataStore
The FormDataStore layer is configured at the node /hippo:configuration/hippo:modules/eforms/hippo:moduleconfig/eforms:formdatastore.
The property eforms:classname must specify the fully qualified class name of the FormDataStore implementation.
When using the CachingFormDataStore, a number of optional configuration properties is available as described in the table below.
Configuration Properties
Property | Default | Description |
---|---|---|
eforms:classname | com.onehippo.cms7. eforms.hst.formdatastore. RepositoryFormDataStore |
An implementation of the com.onehippo.cms7.eforms.hst.formdatastore.FormDataStore interface. Implementations RepositoryFormDataStore and CachingFormDataStore exist out-of-the-box. |
eforms:cachemaxageminutes | 10 | For CachingFormDataStore: specifies that each entry should be automatically removed from the cache once a fixed duration has elapsed after the entry's creation, or the most recent replacement of its value. |
eforms:cacheheapsize | 1000 | For CachingFormDataStore: specifies the maximum number of entries the cache may contain. |
eforms:cookiehttponly | true | For CachingFormDataStore: in case a cookie is used, set its 'httpOnly' flag |
eforms:cookiemaxageminutes: | -1 | For CachingFormDataStore: in case a cookie is used, set its max age in minutes. If -1, it will be a session cookie (recommended). |
eforms:cookiename | 'formMapId' | For CachingFormDataStore: in case a cookie is used, use this as cookie name. |
eforms:cookiesecure | false | For CachingFormDataStore: in case a cookie is used, set its 'secure' flag |
eforms:usecookie | false | For CachingFormDataStore: use a cookie, instead of u_u_i_d render parameter, to keep the form map id in between storing and retrieving the form map. |
Default RepositoryFormDataStore Configuration
The default configuration is for the RepositoryFormDataStore and looks as follows:
/eforms:formdatastore: jcr:primaryType: hipposys:moduleconfig eforms:classname: com.onehippo.cms7.eforms.hst.formdatastore.RepositoryFormDataStore helptext: Property eforms:classname should contain an implementation of com.onehippo.cms7.eforms.hst.formdatastore.FormDataStore interface. Implementations RepositoryFormDataStore and CachingFormDataStore exist out-of-the-box.
Example CachingFormDataStore Configuration
The example below configures the CachingFormDataStore and the use of cookies to store the formMap id.
/eforms:formdatastore: jcr:primaryType: hipposys:moduleconfig eforms:cachemaxageminutes: 10 eforms:cacheheapsize: 1000 eforms:classname: com.onehippo.cms7.eforms.hst.formdatastore.CachingFormDataStore eforms:cookiehttponly: true eforms:cookiemaxageminutes: 10 eforms:cookiename: formMapId eforms:cookiesecure: false eforms:usecookie: true