Information collection
Information collection lets visitors send data through a content object: a feedback form, a poll, a sign-up form. The fields are attributes of the object's class marked Information collector. Visitors fill them in; editors never do. Each time someone sends the form, one collection is stored with one value per collector attribute, apart from the object's own content, so a form can be sent thousands of times without creating a single new version.
How it fits together
- A class has collector attributes, for example a Feedback form class with Name (text line), Email and Message (text block), each with Information collector ticked.
- Its template shows those attributes as form fields and posts to content/action. attribute_view_gui shows a collector attribute with its collect template (content/datatype/collect/<datatype>.tpl) instead of its value.
- The kernel checks the input, stores the collection (tables ezinfocollection and ezinfocollection_attribute) and then, depending on collect.ini, mails it, shows a result page or redirects.
- Editors read the collections under Setup > Collected information (/infocollector/overview) and export them as CSV.
<form method="post" action={"content/action"|ezurl}>
{attribute_view_gui attribute=$node.data_map.name}
{attribute_view_gui attribute=$node.data_map.email}
{attribute_view_gui attribute=$node.data_map.message}
<input type="submit" name="ActionCollectInformation" value="Send" />
<input type="hidden" name="ContentNodeID" value="{$node.node_id}" />
<input type="hidden" name="ContentObjectID" value="{$node.object.id}" />
<input type="hidden" name="ViewMode" value="full" />
</form>
All three hidden fields are needed: they tell content/action which object collects and which view to show afterwards.
What happens after sending: collect.ini
The behavior depends on the collection type, which is form by default and can be set per class in [InfoSettings] TypeList[] (the shipped list maps the class identifiers poll, form and feedback) or per object with an attribute named collection_type.
| Block and setting | Meaning | Default |
|---|---|---|
| [EmailSettings] SendEmail | Mail each collection. The mail is made by the template content/collectedinfomail/<type>.tpl, which can set the receiver (email_receiver); otherwise it goes to site.ini [InformationCollectionSettings] EmailReceiver, else to [MailSettings] AdminEmail. An object can switch mailing on or off with an attribute named collection_email. | enabled (disabled for polls) |
| [DisplaySettings] Display | After sending: result (the result page), redirect (to RedirectURL) or node (the object again). | result |
| [CollectionSettings] CollectAnonymousData | Accept collections from visitors who are not signed in. | enabled |
| [CollectionSettings] CollectionUserData | multiple: a user may send many times; unique: once (polls). | multiple (unique for polls) |
The result pages are the templates content/collectedinfo/form.tpl, poll.tpl and feedback.tpl of the design, chosen by the type. Collections hold what visitors typed, often personal data: give access to Setup > Collected information only to those who need it, and remove old collections. See the Collected information guide.
Contributors
- Balazs Halasy
- Geir Arne Waaler
- James Robertson Commenter
- Graham Brookins Updated Maintainer
Comments (1 historical)
Written by readers of the earlier documentation sites, kept as they were.
Two more hidden inputs also required.
James Robertson ·
After much painful trail and error I have determined that the following hidden input fields are required within the form:
<input type="hidden" name="ContentObjectID" value="{$node.object.id}" />
<input type="hidden" name="ContentNodeID" value="{$node.node_id}" />
[Why oh why isn't this documented!? It simply does not work without it :-[