This page is still a beta!

1.2. Users manual

Simply use the mail form element as usual but take advantage of the new features.

New Reserved fields

  • subject_copy

  • subject_auto_respond

  • from_auto_respond

  • template

  • template_html

  • template_auto_respond

  • template_auto_respond_html

  • db_tables

  • db_fields[<table>]

  • db_key[<table>]

  • db_mode[<table>]

You can use these fields either directly (eg. “| template=hidden | fileadmin/mailtmpl.txt”) or set them comfortably from the mail wizard. You can even select the templates with the Typo3 element browser (allowed extensions are .tpl, .tmpl and .txt respectively .htm, .html)!

db_tables takes database table names as valid content. For each listed table there is a set of fields reserved that contain the table name. Eg. db_tables=my_table will have a corresponding db_fields[my_table]=field1,field2. See below for more information on storing form values in the database.

Templates

To use templates supply the form with a path to a template file (relative to the Typo3 installation). You can create templates for the mail sent to you (template and template_html) and the mails sent to the form submitter (template_auto_respond and template_auto_respond_html).

Markers

For the subject and the templates markers may be used.

Form fields:

###FIELD###

Additionally to all the form fields, the following pseudo fields can be used.

###_FROM###

From: name

###_EMAIL###

From: email

###_DATE###

Current date in the format YY-MM-DD (allows natural sorting in the mail client)

###_TIME###

Current time in the format HH:MM

###_SITE###

Site name

###_PAGE###

Page title

###_PID###

Page ID

Form prefilling

If the name of a form field matches a “standard” name then the field will be prefilled with corresponding data from the current front-end user. In such a case the page will be marked as non-cachable by the extension whether a FE user is logged in or not.

form

fe_users

meaning

name

name

name

email

email

email

first_name

first name

middle_name

middle name

last_name

last name

title_ac

academic title

title_bs

business title

Note:

Only name and email are standard, your system administrator has to extend the user table and to configure this extension to make the other form fields available.

Storing form values in the DB

  • db_tables = <table1>,<table2>,...,<tableN>

  • db_fields[<table>] = <db_field1>[=<form_field1>],<db_field2>[=<form_field2>], ... ,<db_fieldN>[=<form_fieldN>]

  • db_key[<table>] = <db_field1>,<db_field2>, ... ,<db_fieldN>

  • db_mode[<table>] = new | add | change

Names of fields can be different in the form and the database.

Modes:

  • new – only new records are written (INSERT)

  • add – records are either created or changed depending on key (INSERT/UPDATE)

  • change – records are only changed (UPDATE)

To use the modes add and change you have to supply a value for db_key. If a record exists with the given key, it will be updated (both modes). In add mode a new record will be created if no such record exists for this key.

Example:

db_tables = my_log, some_data
db_fields[my_log] = sender,email
db_mode[my_log] = new
db_fields[some_data] = name=sender,email,newsletter=subscribe
db_key[some_data] = email
db_mode[some_data] = add

In this example the form data is written into two different tables. Into my_log a new record is written for each form submission (mode “new”). Into some_data a new record will be created or an existing one updated determined by the field email. Note also that the form fields are named sender and subscribe, but the database are named name and newsletter.

Using the wizard:

The wizard will only display detail fields (db_fields, db_key and db_mode) for tables that have already been configured. That means initially only an empty DB-tables field will be visible. After entering one ore more table names you have to save the form. Now you will see the detail fields.

Note:

Only tables , fields and modes can be used that have been enabled by your system administrator.