Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,090 of 9,090 pages
About the help in other languages
All help pages

Building a contact form, step by step

A complete contact form in ten steps - class with collector fields, the form object, its template, mail to your team, a thank-you redirect, spam protection, permissions for visitors and a final test.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/creators/website-creators/building-a-contact-form.md

On this page

Building a contact form, step by step

This page is for website creators who need a working contact form. It uses the information collector (Forms with the information collector). If your site package ships the Feedback form class (feedback_form), steps 1 and 2 are already done; start at step 3.

Steps

1. The class. In Setup > Classes > Content > New class: name Contact form, identifier contact_form, container off. Attributes:

NameIdentifierDatatypeRequiredInformation collector
TitletitleText lineyesno
IntroductiondescriptionRich textnono
Your namesender_nameText lineyesyes
Your e-mailemailE-mailyesyes
MessagemessageText blockyesyes

Object name pattern: <title>.

2. Spam protection. Add a reCAPTCHA or hCaptcha attribute when one of those extensions is active (Spam protection for forms).

3. The form object. Create a Contact form called "Contact" under the root folder, write an introduction, publish.

4. The template. Copy the shipped feedback form template into your design as override/templates/full/contact_form.tpl, rename the fields to your identifiers, and add the override rule:

# settings/siteaccess/<site>/override.ini.append.php
[full_contact_form]
Source=node/view/full.tpl
MatchFile=full/contact_form.tpl
Subdir=templates
Match[class_identifier]=contact_form

Give every input a visible <label>; mark required fields in text, not only by color.

5. Mail. Set the receiver:

# settings/siteaccess/<site>/site.ini.append.php
[InformationCollectionSettings]
EmailReceiver=[email protected]

and override content/collectedinfomail/form.tpl if the mail should look different.

6. Thank-you page. Create a page "Thank you" and redirect to it:

# settings/siteaccess/<site>/collect.ini.append.php
[DisplaySettings]
Display=redirect
RedirectURL=/Thank-you

7. Visitors may send. Anonymous needs content/read on the form (Section Standard is enough) and the content/collectinformation view uses the read function, so nothing else is needed. Leave CollectAnonymousData=enabled.

8. Caches. php bin/php/ezcache.php --clear-id=template-override --allow-root-user, then --clear-tag=template and --clear-tag=content.

9. Test, logged out. Send the form with an empty required field (an error message appears beside it), then correctly (the thank-you page appears). With the file mail transport, check the mail in the mail directory.

10. Check the submission in Setup > Collected information: the Contact object has one collection.

Checklist

  • To do: Every input has a label; errors are announced next to the field.
  • To do: Spam protection is on.
  • To do: The privacy note says what happens with the data.
  • To do: Mail arrives at the team address (with real mail switched on).
  • To do: Reloading the thank-you page does not resend.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x