How to manage forms in Contao

The built-in form generator can be used to create interactive forms that are sent via e-mail or stored in the Contao database. Uploaded files can be sent as e-mail attachment or stored in the Contao files directory. The form generator supports four different data formats:

Format Description
Raw data The form data will be sent as plain text message with each field in a new line.
XML file The form data will be attached to the e-mail as an XML file.
CSV file The form data will be attached to the e-mail as a CSV file.
E-mail Ignores all fields except email, subject, message and cc (carbon copy) and sends the
form data like it had been sent from a mail client. File uploads are allowed.

Form fields

Similar to content elements, Contao provides a separate element for each type of form field like text fields, password fields, select menus, file uploads, hidden fields or submit buttons. Here is an overview of the Contao core form fields:

Field CSS class Description
Headline headline A custom field to insert a section headline.
Explanation explanation A custom field to insert an explanation text.
HTML code - A custom field to insert HTML code.
Text field text A single-line input field for a short or medium text.
Password field password A single-line input field for a password.
Textarea textarea A multi-line input field for a medium or long text.
Select menu select/multiselect A single- or multi-line drop-down menu.
Radio button menu radio A list of multiple options from which one can be selected.
Checkbox menu checkbox A list of multiple options from which any can be selected.
File upload upload A single-line input field to upload a local file to the server.
Hidden field - A single-line input field that is not visible in the form.
Security question captcha A simple math question to protect against spam bots (CAPTCHA).
Submit field submit A button to submit the form.

Add a comment