Login / Status
developer.Resource
Home . Documentation . Document Library . Extension Manuals
Sponsors
hosted by punkt.deTYPO3 and Open Source Magazine

1.3. Configuration and usage of mailformplus

  1. Install the module with the Extension manager.

  2. Insert a “plugin” element on the page where the form should be shown – pluginname: “mailformplus”.

    New in Version 4.0.0: Only the plugin element is needed! (no mailformplus record anymore)

  3. configure the mailformplus element Tip: you can define default values for the fields via TypoScript! see section “General TypoScript” for more information.

  4. error handling: if you need specific/advanced server side error handling, you can define the error check(s) of the fields via TypoScript. (since 3.9)

Important note if you are updating from old versions to version > 3.9.0:

If you are using file uploads within your form, the user or admin receives an email having showing a link to the uploaded file(s). After the update to 3.9.0 only the filename will be shown. To fix this, you have to define the correct TS settings for the field:

plugin.tx_thmailformplus_pi1.fieldConf.[name of fileupload field] {
fileUpload = uploads/pics/
uploadedFiles.mail {
plainTemplate = ###filePath######fileName###\n
}
}

If you are using the new functionality to send HTML-mails, you should also define:

 uploadedFiles.mail.HTMLTemplate = <a href="###filePath######fileName###">###fileName###</a><br>

the HTML-template

This is a “normal” static HTML document including the form fields.

Make sure you don't have a <BODY> or <HTML> tag in there – it should only consists of the real pure HTML-form starting with <form .... > and ending with </form>

You can also declare javascript functions if you like to check some fields before the form is submitted.

Example forms:

In the /th_mailformplus/example_form/ directory you find two example templates files and one example TypoScript file.

  1. mailformplus_demo.html:

    a singlepage form example

  2. multipage.html:

    a multipage form example with file upload, error checks,... .

  3. multipage_conditions.html (new since 4.0.0):

    a multipage form example with different routes according to the user input. The buildup of this example form looks like this:

  1. multipage_TypoScript_setup.txt

    example TypoScript settings for the “multipage.html” example

  1. multipage_conditions_TypoScript_setup.txt ... TS for multipage_conditions.html example

Guidelines for the HTML-template:

make sure that:

  1. each form has a form-start-tag beginning with "<form" or "<FORM"

  2. each multi page-form has a form-end-tag "</form>" or "</FORM>"

  3. fieldnames are enclosed by " eg. <input type="text" name="email">

Requirements for multipage forms:

  1. only woks with JavaScript enabled.

  2. Works with or without JavaScript, set via TypoScript setting plugin.tx_thmailformplus_pi1.multipage_without_js. Usage without Javascript requires some changes in the HTML template. See example form for further details. (since 4.0.0)

  3. add the marker ###ADDITIONAL_MULTIPAGE### in every step between the <form> and </form> tag.

    This is where the automatic generated JS function and hidden fields are written.

Hidden fields you have to declare in the HTML-form:

<input type="hidden" name="id" value="###PID###">
<input type="hidden" name="submitted" value="1">
<input type="hidden" name="L" value="0">

Subtemplates:

###TEMPLATE_FORM###

Main form template including <form></form> tag.

Use this subtemplate for a single page form.

###TEMPLATE_FORM[1...x]###

Main form template including <form></form> tag.

Use this subtemplate for a multi page form.

example:

###TEMPLATE_FORM1###  begin/end ... step 1

###TEMPLATE_FORM2###  begin/end ... step 2

Subtemplates:

To be defined in first step (###TEMPLATE_FORM1###).

###FORM_STARTBLOCK### begin/end

###FORM_ENDBLOCK### begin/end

can be used as markers in the following steps:

###STARTBLOCK###

###ENDBLOCK###

example:

Step 1:

<!-- ###TEMPLATE_FORM1### begin -->
  <!-- ###FORM_STARTBLOCK### begin-->
    ...
  <!-- ###FORM_STARTBLOCK### end-->
    ...
    ...
    ...
 
  <!-- ###FORM_ENDBLOCK### begin -->
    ...
  <!-- ###FORM_ENDBLOCK### end -->
<!-- ###TEMPLATE_FORM1### end -->

Step 2:

<!-- ###TEMPLATE_FORM2### begin -->
###STARTBLOCK###
...
...
###ENDBLOCK###
<!-- ###TEMPLATE_FORM2### end -->

###TEMPLATE_FORM[1...x]_[postfix]###

Define different subparts for one step of the form using a postfix value and define which postfix to use by setting TS-conditions (Example below in Typoscript section)

example:

Step 1:

<!-- ###TEMPLATE_FORM1### begin -->
  <!-- ###FORM_STARTBLOCK### begin-->
    ...
  <!-- ###FORM_STARTBLOCK### end-->
    ...
    ...
    ...
 
  <!-- ###FORM_ENDBLOCK### begin -->
    ...
  <!-- ###FORM_ENDBLOCK### end -->
<!-- ###TEMPLATE_FORM1### end -->

Step 2a:

<!-- ###TEMPLATE_FORM2_a### begin -->
###STARTBLOCK###
...
...
###ENDBLOCK###
<!-- ###TEMPLATE_FORM2_a### end -->

Step 2b:

<!-- ###TEMPLATE_FORM2_b### begin -->
###STARTBLOCK###
...
...
###ENDBLOCK###
<!-- ###TEMPLATE_FORM2_b### end -->

Typoscript:

[globalVar = GP:[fieldname] = [value]]
plugin.tx_thmailformplus_pi1.multipage.2.postfix = _a
[globalVar = GP:[fieldname] = [value]]
plugin.tx_thmailformplus_pi1.multipage.2.postfix = _b
[global]

###TEMPLATE_SUBMITTED_OK###

This subtemplate is shown if form was submitted and all required fields were filled out and no redirect is defined.

###TEMPLATE_EMAIL_USER###

###TEMPLATE_EMAIL_USER_HTML###

Plaintext/HTML text sent to the user. (only if this function is used)

Define both subparts (plain and HTML) because since version 3.9.0 all mails are sent as multipart mails . Means: if the users email client is not able to display HTML mails, the plaintext mail is shown – otherwise the HTML mail.

New in Version 4.0.0: Possibility to use postfixes for email template subparts too! Use them to define different email templates for different route.

Example:

normal:

###TEMPLATE_EMAIL_USER###

###TEMPLATE_EMAIL_USER_HTML###

user chose route a:

###TEMPLATE_EMAIL_USER_a###

###TEMPLATE_EMAIL_USER_HTML_a###

user chose route b:

###TEMPLATE_EMAIL_USER_b###

###TEMPLATE_EMAIL_USER_HTML_b###

###TEMPLATE_EMAIL_RECEIVER###

###TEMPLATE_EMAIL_RECEIVER_HTML###

Plaintext/HTML text sent to the receiver specified in the mailformplus record or via TypoScript.

also see ###TEMPLATE_EMAIL_USER###

###TEMPLATE_PRINT###

HTML template which will be stored in session after the form got submitted.

With the help of a user-function you can display this template (with replaced markers of course) on the “thank you” page.

Use ###value_[name of inputfield]### or ###[name of inputfield]### markers as in all other subtemplates.

Also see section “print template” for more informations.

New in Version 4.0.0: Possibility to use postfixes!

###TEMPLATE_ERROR###

Define error messages for each input field within this subpart.

example:

<!-- ###TEMPLATE_ERROR### begin -->
  <!-- ###ERROR_email### begin -->
    Fill out a correct email address!
  <!-- ###ERROR_email### end -->
<!-- ###TEMPLATE_ERROR### end -->

New in Version 4.0.0: Possibility to use postfixes!

Example:

<!-- ###TEMPLATE_ERROR### begin -->
  <!-- ###ERROR_email_a### begin -->
    Fill out a correct email address – route A!
  <!-- ###ERROR_email_a### end -->
  <!-- ###ERROR_email_b### begin -->
    Fill out a correct email address – route B!
  <!-- ###ERROR_email_b### end -->
<!-- ###TEMPLATE_ERROR### end -->

Markers:

###value_[name of inputfield]###

GET/POST value of the given inputfield.

example:

<input type=”text” name=”email” value=”###value_email###”>

###checked_[name of inputfield]_[value of inputfield]###

Only for use with checkboxes and radiobuttons.

example:

checkbox:

<input type="checkbox" name="topic" value="webdesign" ###checked_topic_webdesign###>Webdesign

radiobutton:

<input type="radio" name="contact_via" value="email" style="border-style:none;" ###checked_contact_via_email###>e-mail

###selected_[name of dropdown]_[value of dropdown]###

Only for use with dropdowns.

example:

dropdown::

<option value="webdesign" ###selected_topic_webdesign###>Webdesign</option>

###[marker name from TypoScript]###

Marker defined in TypoScript.

example:

plugin.tx_thmailformplus_pi1.markers.departments < temp.departments

###ERROR###

Cumulated error messages.

###error_[fieldname]###

Error text for one specific field.

Error-text can be defined via subtemplate (see above section), via TypoScript or in locallang.php using prefix 'error_'.

###FEUSER_[fieldname]###

You can access name, email, ... fields from the logged in user (frontend-user) and fill out the name or emailaddress automatically.

Attention: the fieldname has to be written in CAPITAL letters.

###CAPTCHA###

Only works if you have the “captcha” extension installed.

This marker will be replaced with a picture showing some only human readable text. The user has to type the text shown on the picture into a inputfield in your form. To enable the check if the submitted text is the same as shown on the picture, you have to set the following TypoScript:

plugin.tx_thmailformplus_pi1.captchaFieldname = [name of the inputfield]

See section “general Typoscript” for more information.

###RECAPTCHA###

Only works if you have the “jm_recaptcha” extension installed.

This marker will be replaced with a picture showing some only human readable text. The user has to type the text shown on the picture into a inputfield in your form. To enable the check if the submitted text is the same as shown on the picture, you have to set the following TypoScript:

plugin.tx_thmailformplus_pi1.useRecaptcha = 1

See section “general Typoscript” for more information.

Specific markers for  multipage forms:

 

###ADDITIONAL_MULTIPAGE###

This marker has to be inserted in every step-subtemplate within <form> and </form> tag.

This is where the automatic generated JS function and hidden fields are written.

###curStep###

Number of current step.

###maxStep###

Number of steps.

###link_nextStep_start###

###link_nextStep_stop###

<a> start-tag for next page

</a> end-tag for next page

###link_prevStep_start###

###link_prevStep_stop###

<a> start-tag for previous page

</a> end-tag for previous page

###link_reload_start###

###link_reload_stop###

<a> start-tag for submitting form but stay on the same step

</a> end-tag for submitting form but stay on the same step

Specific markers for file uploads:

 

###[name of upload field]_fileTypes###

Allowed filetypes defined in TS eg. “jpg,gif,pdf”

###[name of upload field]_fileSize###

Maximum allowed filesize per file defined in TS.

###[name of upload field]_numberOfAllowedFiles###

Maximum number of files that can be uplaoded with this field.

###[name of upload field]_numberOfUploadedFiles###

Number of uploaded files via this field.

###[name of upload field]_numberOfRemainingFiles###

Number of remaining files that can be uploaded

Markers to get path to current page (e.g. for form action)

 

###REL_URL###

relative path to current page

###ABS_URL###

absolute path to current page

###required_[fieldname]###

placeholder marker for sign to mark required fields. Needed only in combination with default.required_marker setting

Default content of emails:

If no Template ###TEMPLATE_EMAIL_RECEIVER###  or ###TEMPLATE_EMAIL_USER### is defined,  all fields will be sent to the specified email address in this format:

[fieldname]:[value]

TypoScript

plugin.tx_thmailformplus_pi1

emailHeader *

optional

to send out HTML-emails or emails with UTF-8 encoding

the values will be added to the header of all emails that are sent out

comment:

if you don't specify your own character set here, the default character set of the typo3 installation is taken

emailParameter *

optional

this string is used when sending the mail via the php mail() function as 5th parameter

example:

emailParameter = -f automailer@yourdomain.com

markers

optional

syntax:

markers.[markername] = [TypoScript]

[markername] has to be used within the HTML-template as marker: ###[markername]###

see example below

New in version 4.0.0:

syntax:

markers.[markername] = SUBPART

markers.[markername].value = [subpartname]

Substitutes the marker [markername] with the content of the subpart [subpartname] both defined in the HTML template file.

[subpartname] can be written with or without ###.

captchaFieldname

optional

Only works if you have the extension “captcha” installed.

Set the name of the inputfield where the user types in the text shown on the captcha-picture.

example:

captchaFieldname = captcha_check

freecapFieldname

optional

Only works if you have the extension “sr_freecap” installed.

Set the name of the inputfield where the user types in the text shown on the captcha-picture.

example:

freecapFieldname = captcha_check

useRecaptcha

optional

Only works if you have the extension “jm_recaptcha” installed.

Enable the usage of jm_recaptcha. Marker ###RECAPTCHA### will be substituted

example:

useRecaptcha = 1

saveUserFunc

optional

Calls an user defined function after the form was submitted successfully.

example:

saveUserFunc = EXT:myext/class.tx_myext.php:tx_myext->doit

Parameters can be passed on to the user function like this:

saveUserFunc.dummy = hello

See section “Hook for post-processing” for more details.

limitMailsToUser

Limit the number of mails that are sent to the user.

default value (if not defined in TS): 2

Only necessary if you are sending a confirmation mail to the users email address he/she filled out. (multiple email addresses could be filled  which opens the doors for spamming)

debug

ATTENTION:

If the extension does not work as expected, set this to 1 to display various debug messages. Do NOT activate this feature on an online page – the messages would be displayed also to the users!

multipage_without_js

default: 0

If set, multipage forms do not use javascript.

If this setting is set to 1, further changes of the template are required. Please see 'multipage_conditions.html' for an example.

example:

multipage_without_js = 1

use this syntax for next/back:

<input type="submit" ###submit_nextStep### value="next" />

<input type="submit" ###submit_prevStep### value="back" />

multipage_without_js = 0

use this syntax for next/back:

###link_prevStep_start###back###link_prevStep_stop### ###link_nextStep_start###next###link_nextStep_stop###

multipage_without_auto_hidden

default: 0

If set, multipage forms do not hide unused step templates using CSS.

If this setting is set to 1, you have to add the form fields of every step as hidden fields into the subparts of the other steps to ensure that no value gets lost when user is browsing through the form.

It is important to add a hidden field for last step to every step template, when using multipage_without_js = 1, so that the error checks are done correctly. The hidden field should look like this:

<input type="hidden" name="mp_last_step" value="###maxStep###" />

correctRedirectUrl

default: 0

If set, URLs set with TS-setting email_redirect are parsed for '&amp;', which gets substituted to '&'. Introduced this options because URLs set with TypoScript did not get set correctly even if htmlSpecialChars setting was used in the TypoScript setup.

langFile

default: ''

Specify a custom language file by setting relative path to the file.

example:

plugin.tx_thmailformplus_pi1.langFile = fileadmin/mailformplus/locallang.php

example locallang.php:

$LOCAL_LANG = Array (

'default' => Array (

'fieldname' => 'Caption',

),

'dk' => Array (

),

'de' => Array (

'fieldname' => 'Beschriftung',

),

'no' => Array (

),

);

For detailed example see section “How to set up multilanguage forms”

disableErrorCheckFields

optional

comma separated list of fields that should be neglected during error check. useful to make mandatory fields dependent on the input of other fields. Overrules the errorCheck settings of these fields in fieldConf.

example:

[globalVar = GP:field1= [somevalue]]

plugin.tx_thmailformplus_pi1.disableErrorCheckFields = field2,field3

[global]

if field1 has a specific value, field2 and field3 will not be checked for errors.

stylesheetFile

optional

specify a stylesheet file which gets dynamically loaded at runtime

example:

plugin.tx_thmailformplus_pi1.stylesheetFile = fileadmin/mailformplus/styles.css

errorUserFunc

optional

Needed when doing error checks using the “userValidation” option.

Define a user function which gets called for user validation

example:

plugin.tx_thmailformplus_pi1.errorUserFunc = EXT:myext/class.user_myvalidation.php:user_myvalidation->user_validate

plugin.tx_thmailformplus_pi1.fieldConf.[name of inputfield].errorCheck=userValidation

plugin.tx_thmailformplus_pi1.fieldConf.[name of inputfield].errorCheck.checkFor=telephonenumber

When checking for errors using “userValidation”, the function “user_validate” of the class “user_myvalidation” gets called with the parameter checkFor=”telephonenumber”.

checkBinaryCrLf

optional

Useful to make sure that text of form fields gets displayed nicely in HTML-Emails.

Replaces all x'0a' line feeds with '<br />' in a text and deletes all \\ from a text.

Enter a comma separated list of markers the replacing should be performed with. The replacing is only done for HTML-Emails

predef.[unique string for the predefined form]

(since 4.0.5)

optional

Predefine various forms with TypoScript. The predefined forms will be shown in the plugin-element as dropdown. An editor can simply choose and insert one of the predefined forms.

All TypoScript configuration methods described here in this manual can be used for each predefined form.

example for two predefined forms:

plugin.tx_thmailformplus_pi1.predef.simple_contact {

    name = simple contact form

    default {

         email_htmltemplate = ../../fileadmin/simpleform.html

         email_subject_user  = Contact form submitted

    }

    fieldConf {

         email.errorCheck = required

    }

}

plugin.tx_thmailformplus_pi1.predef.advanced_contact {

    name = advanced contact form

    default {

         email_htmltemplate = ../../fileadmin/advancedform.html

         email_subject_user  = Contact form submitted

    }

    fieldConf {

         email.errorCheck = required

    }

}

predef.[unique string for the predefined form].name

[string]

This is the name of the predefined form. It is displayed in the dropdown within the plugin-element.

preprocUserFunc

Enables you to call a function to process form values before processing through mailformplus.

Example:

plugin.tx_thmailformplus_pi1.preprocUserFunc = (...)/myown_preproc.php:myown_preproc->doit

Function could look like this:

class myown_preproc { function doit(&$params, &$ref){ $_POST["fruit_color"]=somehow_find_the_color_for($_POST["fruit"]); } }

* .. no longer used since  version 3.9.0

plugin.tx_thmailformplus_pi1.default

The default settings specified via TypoScript are used if the corresponding field in the mailformplus record is not filled out.

Since version 3.9.0 you can not only set string values, but also TypoScript “TEXT” objects to all the listed .default settings.

Since version 4.0.0 you can set any TypoScript object.

example:

plugin.tx_thmailformplus_pi1.default.email_subject = TEXT
plugin.tx_thmailformplus_pi1.default.email_subject.data = GPvar:subject
plugin.tx_thmailformplus_pi1.default.email_subject.wrap = 1|2
 

.email_to

email

help@mydomain.com

Info: That's the email address where the “admin” email is sent to.

.email_subject

[text]

contact form was filled out

Info: That's the subject of the admin-email.

.email_sender

[email]

homepage@mydomain.com

Info: This emailaddress is used as sender in the admin-email.

.email_redirect

[pageID]

10

Info: PageID where the user gets redirected to when submitting a correct filled out form.

.email_requiredfields

[fieldnames] used in the form

name,email

Info: Use fieldnames of the inputfields to enable a server side check if they are filled out.

.email_requiredfields.wrap

to add required fields dynamicly

example:

email_requiredfields.wrap = |,subject

.email_htmltemplate

[path] or [TypoScript object] to html-template

../../fileadmin/forms/contact.html
or
= FILE
.file = EXT:myext/form.html

ATTENTION: always use “../../” as prefix!

Info: This is the path and the HTML-template file with the form.

.email_replyto

[fieldname] used in the form

email 

Info: Fill in the name of the formular inputfield where the user fills in the email address. This emailaddress is then taken as reply-to address. Clicking on “reply” in your email program to an admin-email lets you send an email directly to the user.

.email_sendtouser

[fieldname] used in the form

user_email

Info: If you want a email to be sent to the user who has submitted the form, you have to use the inputfield name where the user puts in his/her emailaddress here.

.email_subject_user

[text]

Thank you for your registration.

Info: That's the subject of the email sent to the user. (see “email_sendtouser”)

.email_attachment

filepath or name of a form field

this file/these files will be added as attachment to the receiver e-mail

example:

email_attachment = fileadmin/content/hello.jpg

email_attachment = photo

.required_marker

optional

Enter a sign to mark reuqired fields. Markers ###required_[fieldname]### will get replaced with this sign.

.email_html_as_attachment

Optional (default:0)

If set, the HTML version of the emails will get sent as attachment of the plain text mail.

plugin.tx_thmailformplus_pi1.fieldConf.[name of inputfield]

Since 3.9.0 more detailed settings per input field can be defined.

- error checks (server side)

- default value (TS TEXT object)

- upload field settings eg. allowed fileTypes, fileSize,...

 

.defaultValue

TypoScript “Text” object definition.

New: can be a string too

example:

fieldConf.email.defaultValue = [insert email here]

example:

fieldConf.email.defaultValue.value = admin@mydomain.at
.defaultValues {
    day.data = date :U
    day.strftime = %d
    month.data = date : U
    month.strftime = %b
    year.data = date : U
    year.strftime = %Y
}

.errorCheck

Server side error check for the field.

This TS setting overrules the “required” setting in the mailformplus record!

.errorCheck can be one of the following:

- email ..... validated as email

- integer ... validated as integer

- float  .... validated as float ("." and "," allowed!)

- required ... must be filled out

- optional ... field is optional, but if it's filled out,

               it's validated to the rest of errorChecks defined

- date ... validated as date. format can/has to be specified

           example:

     errorCheck = date:dd/mm/yyyy
     errorCheck = date:d.m.y

           format is case insensitive. dd/mm/yyyy equals DD/MM/YYYY

 - time ... validated as time. format can/has to be specified

            example:

      errorCheck = time:hh:mm
      errorCheck = time:h-m

            format is case insensitive. hh:mm equals HH:MM

New  since Version 4.0.0:

- isInDBTable:[db tablename]|[db fieldname]|[additional WHERE clause] ... Check if the value already exists in DB

    example: errorCheck = isInDBTable:tt_content|header|AND deleted=0

    returns error if the given value is not in the database (3rd parameter “additional WHERE clause” was added in 4.0.5)

- isNotInDBTable:[db tablename]|[db fieldname]|[additional WHERE clause] ... Checks if the value is not in the DB

    returns error if the given value already is in DB  (3rd parameter “additional WHERE clause” was added in 4.0.5)

- notDefaultValue ... Checks if the given value is not equal the value defined via TS-setting defaultValue.value

- userValidation ... validates the field using the custom validation function

    example see section “Hook for custom validation example”.

New since version 4.0.1:

- min ... check if an array has at least [min] items

- max ... check if an array hast at least [max] items

     example:

          checkboxArray {

            errorCheck = required,min:2,max:4

          }

You can specify multiple errorchecks by separating them by ","

example:

.errorCheck = required, email

errorCheck.ereg

validated to match the regexp given

example for correct IP validation:

errorCheck.ereg = ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$

errorCheck.eregi

 like "ereg" but case insensitive

errorCheck.dateRange.min

used to check dates not only for format but for a certain range.

Enter a min date value in the format the user has to enter the date

example

   dateRange.min = 01.01.1970

errorCheck.dateRange.max

used to check dates not only for format but for a certain range.

Enter a max date value in the format the user has to enter the date

example

   dateRange.max = 31.12.2050

.errorText

Text beeing displayed when error occurs.

Info:

.errorText overwrites the error-subtemplate value defined in the template.

example:

email.errorText = <li>fill out a correct email</li><br>

New in Version 4.0.0:

Define errorText as a Typoscript TEXT-Object to be able to set multilanguage error texts via Typoscript!

errorText = TEXT

errorText.value = <li>fill out a correct email</li> errorText.lang.de = <li>Korrekte E-Mailadresse eingeben</li>

Settings only for file upload fields:

Uploaded files are saved as [md5 hash]_[page-id]_[saveDB id if exists]_[original filename]

 

.numberOfAllowedFiles

Number of files the user is allowed to upload via this upload field.

How can a user upload multiple files?

Have a look at the example template in /th_mailformplus/example_form/

.fileTypes

Allowed file types.

example:

picture.fileTypes = jpg,gif

.fileSize

Maximum file size for one uploaded file in Bytes.

example:

picture.fileSize = 200000

.fileUpload

Directory where uploaded files are stored.

example:

picture.fileUpload = uploads/pics/

Special templates and wraps for file uploads which are used for

- the webpage (generally for all steps -  if it's a multipage form )

- the webpage (for one specific step – if it's a multipage form)

- the mails (to receiver and user – for HTML and for plaintext mails separate templates/wraps)

- the mail to the receiver (for HTML and plaintext mails separate templates/wraps)

- the mail to the user (for HTML and plaintext mails separate templates/wraps)

 

.uploadedFiles.template

Template taken for each uploaded file and can be used as ###value_name of inputfield]### marker in the HTML output on the webpage.

Markers to be used within the template:

- ###fileName###

- ###fileSize### ... file size formatted by t3lib_div::formatSize() function

- ###linkDelete_start### *

- ###linkDelete_stop### *

example:

picture.uploadedFiles.template = <tr><td>###fileName###</td><td>###linkDelete_start###remove file###linkDelete_stop###</td></tr>

* Attention:

###linkDelete_start### and ###linkDelete_stop### are only available with multipage_without_js = 0

.uploadedFiles.wrap

Wrap around the lines for each uploaded file (see above).

example:

picture.uploadedFiles.wrap = <table border="0" cellspacing="0" cellpadding="0">|</table>

.uploadedFiles.[step].template

Overwrites the default uploadedFiles.template setting for one specific step.

This setting of course only makes sense if you are using multipage forms.

.uploadedFiles.[step].wrap

Overwrites the default uploadedFiles.wrap setting for one specific step.

.uploadedFiles.print.template

.uploadedFiles.print.wrap

Template taken for each uploaded file and can be used as ###value_[name of inputfield]### marker in the print template.

example:

uploadedFiles.print.template = <a href=”###filePath######fileName###”>###fileName###</a><br>
uploadedFiles.print.wrap = uploaded files:<br>|end of uploaded files<br>

Also see examples-section for more information about the print template.

.uploadedFiles.mail.plainTemplate

.uploadedFiles.mail.HTMLTemplate

.uploadedFiles.mail.plainWrap

.uploadedFiles.mail.HTMLWrap

Template taken for each uploaded file and can be used as ###value_[name of inputfield]### marker in the mails to receiver and user.

example:

uploadedFiles.mail.plainTemplate = ###filePath######fileName###\n
uploadedFiles.mail.HTMLTemplate = ###filePath######fileName###<br>
uploadedFiles.mail.plainWrap = uploaded files:\n|\nend of uploaded files\n
uploadedFiles.mail.HTMLWrap = uploaded files:<br>|<br>end of uploaded files<br>

.uploadedFiles.mailReceiver.plainTemplate

.uploadedFiles.mailReceiver.HTMLTemplate

.uploadedFiles.mailReceiver.plainWrap

.uploadedFiles.mailReceiver.HTMLWrap

Template taken for each uploaded file and can be used as ###value_[name of inputfield]### marker in the mails to receiver. (overwrites the .mail.plainTemplate and .mailHTMLTemplate  templates)

If no HTMLTemplate is defined, but HTML mails are sent, the template of plainTemplate is taken instead.

example see above

.uploadedFiles.mailUser.plainTemplate

.uploadedFiles.mailUser.HTMLTemplate

.uploadedFiles.mailUser.plainWrap

.uploadedFiles.mailUser.HTMLWrap

Template taken for each uploaded file and can be used as ###value_[name of inputfield]### marker in the mails to user. (overwrites the .mail.plainTemplate and .mailHTMLTemplate  templates)

If no HTMLTemplate is defined, but HTML mails are sent, the template of plainTemplate is taken instead.

example see above

plugin.tx_thmailformplus_pi1.multiPage

.js

JavaScript function call before form is submitted.

example:

.js = alert('general javascript');

.[step].js

JavaScript function for one specific step – called before form is submitted.

example:

.1.js = alert('step1 javascript');

.[step].postfix

define custom postfix for a specific form step. Useful to create multipage forms with conditions.

TypoScript: Saving the submitted values into a DB table of your choice.

(since 3.1)

This allows you to choose a database table and store all (or some) values submitted via a form into this table.

Also file uploads can be handled.

Typoscript support:

plugin.tx_thmailformplus_pi1

saveDB = 1

1 ... enable saving to DB

0 ... disable saving to DB (or if not defined)

saveDB.dbTable

Name of database table used for saving

saveDB.fileUpload *

optional

Directory where the uploaded files (if any) are stored.

The file will be renamed to: [pageID]_[FormularInputFieldName]_[createdRecordID].[fileType]

Example:

saveDB.fileUpload = uploads/tx_threzepte/

saveDB.fileTypes *

optional

allows only uploaded files of this type. Seperate mulitple types by “,”

data will not be saved if the file does not correlate with this types. (use ###error_filetype### placeholder for displaying the error message)

Example: jpg,gif,png,jpeg

saveDB.fileSize *

optional

this limits the maximum size of one uploaded file – data will not be saved if the file is too large (use ###error_filesize### placeholder for displaying the error message)

Example: 50000 (50 Kb)

saveDB.dbinsert

optional

inserts given values into the database. Useful if you want to set the inserted records to “hidden”

example: pid:7,hidden:1

saveDB.dbkey

Default: uid

If you want to insert the records into a table that does not use “uid” as key field.  Important because the generated key is taken as part of the filename (if you allow  the user to upload a file with the form)

saveDB.mapping **

Not default!

You have to specify into which table field the form field is saved.

Abstract: [inputFieldName]:[DBName],[inputFieldName]:[DBName],...

Example:

surname:name,title:title,ingredients:ingredients

How to write two submitted values in one DB-field:

Simply write the two mappings separated by “,”.

example:

surname:name,forename:name

saveDB.if_is_empty.[fieldname] **

optional

[fieldname] ... name of form input field

If field is not filled out, you can specify a default value which will be used.

Example:

saveDB.if_is_empty.subscribe = no

saveDB.fields.[fieldname].mapping

optional

define custom mapping for each form field

saveDB.fields.[fieldname].preProcessing

optional

define preprocessing which is executed before inserting value into DB. Can be Typoscript-Object for using custom userFunc

example:

saveDB.fields.email.preProcessing = TEXT

saveDB.fields.email.preProcessing.value = other value gets discarded

saveDB.fields.[fieldname].postProcessing

optional

define postprocessing which is executed after inserting value into DB. Can be Typoscript-Object for using custom userFunc

example:

fields.description.postProcessing = HTML

fields.description.postProcessing.value.stripHtml = 1

fields.description.postProcessing.value.br = 1

saveDB.fields.[fieldname].if_is_empty

optional

define value that gets written into DB if field value is empty

saveDB.fields.[fieldname].seperator

Default: ,

Use only if [fieldname] is an array!

The array gets imploded using this separator to be written into the DB as a string.

Use 'array' to write array into DB serialized!

saveDB.specialMapping

default: 0

Enables the special mapping feature

saveDB.specialMapping.sub_datetime

store submission datetime in format YYYY-MM-DD HH:SS

sub_datetime = [fieldname]

saveDB.specialMapping.crdate

set timestamp (submission time) to field crdate

saveDB.specialMapping.tstamp

set timestamp (submission time) to field: tstamp

saveDB.specialMapping.logIP

store submission IP to field

logIP = [fieldname]

saveDB.specialMapping.storeuid

store uid to a second field (reference).

Enables storage in CSV as well and

activates marker ###DB_UID### in E-Mails

storeuid = [fieldname]

saveDB.allFields

array

map all form fields into one db field

saveDB.allFields.mapping

set db fieldname to store the values

saveDB.allFields.excludeFields

comma separated list of form fields

values of this fields are not stored in db

saveDB.allFields.leaveEmptyFields

default:0

set if fields which are empty should get stored in db or not.

updateInsteadOfInsert

1 ... executes UPDATE query instead of INSERT.

0 ... default: INSERT

Update is done where “uid=[GPvar:uid]” - so the parameter name is hardcoded to “uid” -> make sure you submit this field.

checkAuth = 1

only works if “updateInsteadOfInsert” is set to 1.

1 ... enables auth-check for updates

0 ... no auth-check is done before the update query is submitted

checkAuth.GPname

string

Name of the GET/POST parameter where the authCode is submitted.

See “API-functions”  how you can create an authCode (short md5).

noDefaultErrorList

0/1

default: 0

With this option you can disable that a list of errors gets shown by default.

With setting this option to 1 you can make it possible to only show an information text with the marker ###ERROR###.

When this option is set to 0 (default), The marker ###ERROR### will contain a list of the fieldnames where an error occurred by default.

saveDB.useDifferentDB

Default:0

Enables the usage of different DB saving options

saveDB.useDifferentDB.driver

The driver to be used to open a connection to the other db.

Examples: mysql, oracle, oci8

saveDB.useDifferentDB.host

Default: localhost

The host of the other db

saveDB.useDifferentDB.port

The port of the other db host.

saveDB.useDifferentDB.user

The username to connect to the other db

saveDB.useDifferentDB.password

The password to connect to the other db

saveDB.useDifferentDB.table

The table in the other db

saveDB.useDifferentDB.db

The other db name

saveDB.useDifferentDB.saveFields

A comma separated list of fileds to be saved into the other db.

Enter names of fields of the settings in saveDB.

Example:

saveFields = titel,vorname,zuname,strasse,plz,ort,telefon,katalog,email

* ... file handling settings. These settings are used for each file upload field. In version > 3.8.0 these (and more) settings can be defined per upload field. See plugin.tx_thmailformplus_pi1.fieldConf settings.

** deprecated since version 4.0.0

Mailformplus API-functions

(since 4.0.5)

Use them to fill markers in TypoScript like this:

In the following examples, the string “{GPvar:email}” will be replaced by the value of the submitted “email” field.

markers.authCode = USER
markers.authCode {
userFunc = user_mailformplusAPI->user_authCode
dbTable = tt_address
where = TEXT
where.value = email="{GPvar:email}" AND deleted=0
where.insertData = 1
}
markers.DB_UID = USER
markers.DB_UID {
userFunc = user_mailformplusAPI->user_getDBValue
dbTable = tt_address
dbField = uid
orderBy = uid desc
where = TEXT
where.value = email="{GPvar:email}" AND deleted=0
where.insertData = 1
}

userFunc = user_mailformplusAPI->user_authCode

Returns a short-md5 hash of the selected database record.

Howto specify which db-record should be selected:

dbTable = [string: database table name]

where = [string: TypoScript object e.g. TEXT]

userFunc = user_mailformplusAPI->user_getDBValue

Returns a specific DB-value of the selected database record.

Howto specify which db-record should be selected:

dbTable = [string: database table name]

dbField = [string: name of the db-table-field which should be returned]

orderBy = [string: will be used as ORDER BY clause in select]

where = [TypoScript object e.g. TEXT]

TypoScript: Configuring the log-table (csv export via backend module)

(since 3.3)

This allows you to specify which fields have to be saved in the log-table and in which order.

Default: all fields submitted (having a value) are saved.

Problem:

When you use checkboxes in your form, a unchecked checkbox won't be saved at all in the log-table. This causes incompatibility in the csv-export-format.

Solution:

Use this typoscript functionality to ensure a fix format for your csv-exports.  

plugin.tx_thmailformplus_pi1

saveLog

1 ... enable customized saving to log-table

0 ... disable customized saving to log-table (or if not defined)

-1... completely disable saving to log-table

default: 0 (all submitted fields having a value are saved)

saveLog.order

specify formular inputfield names separated by “,” that should be saved into log-table

Attention: fields in log-table are also written in this order

saveLog.defaultValue

optional

default: ''

specify  the value that should be saved  if the user has not filled out the formular field. e.g.: a checkbox is not checked

saveLog.exclude

specify formular inputfield names separated by “,” that should NOT be saved into log-table

all other fields are saved

(since 3.4.0)

saveLog.logDateTime

default: 0

enable logging of the submission date and time in

format YYYY-MM-DD.

saveLog.logIP

default: 0

enable logging of the user's ip address

TypoScript: Configuring spam notification

(since 4.0.0)

This allows you to define if a notification e-mail should be sent using the given e-mail address. The E-mail is sent, if the form gets submitted from a host not in the list of allowed referers (see “allowedReferers” definition above).

plugin.tx_thmailformplus_pi1

doNotCheckReferer

default: 0

Set to 1 if you do not want to check the referrer when the form is submitted.

Per default the referer is checked.

allowedReferers

List of host names or IPs (separated by “,”). Server host is added automatically.

spamNotify

1... enable notification

0 ... disable notification

default: 0

spamNotify.emailTo

Specify e-mail address where the notification mail is sent to. If no address is given, no e-mail will be sent!

example: admin@host.com

spamNotify.emailFrom

Specify an e-mail address to be shown as the sender address of the notification mail.

example: spam_detected@host.com

spamNotify.subject

Specify a subject for the notification e-mail.

spamNotify.sendInfo.url

default: 0

value: 1/0

Send information about the page, where the spam was detected.

spamNotify.sendInfo.referer

default: 0

value: 1/0

Send information about the referer trying to submit the form

spamNotify.sendInfo.submittedData

default: 0

value: 1/0

Send the complete data the attacker tried to submit.

TypoScript: Configuring frontend listing

(since 4.0.1)

This allows you to display a list of submitted form data in the frontend.

plugin.tx_thmailformplus_pi2.

template

Path to the HTML template with the markers in

(perhaps the same path resp. the same  document like that one for th_mailformplus!?)

e.g. = fileadmin/templates/mailformplus_contact.html

langFile

default: ''

Specify a custom language file by setting relative path to the file.

example:

plugin.tx_thmailformplus_pi2.langFile = fileadmin/mailformplus/locallang.php

example locallang.php:

$LOCAL_LANG = Array (

'default' => Array (

'fieldname' => 'Caption',

),

'dk' => Array (

),

'de' => Array (

'fieldname' => 'Beschriftung',

),

'no' => Array (

),

);

LinkVars

The content of this variable will be written into the marker ###LINK2SHOW###

e.g. look into the example below.

sourcePagePID

Because of possible different mailfomplus-forms and -pages and their possible different number of Markers (###value_name### etc.) you have to tell the extension what messages should be displayed in the page that belongs to this ext. Template (the template that corresponds to the page where you want to show the list)

e.g. = 43

Shows only messages sent with THAT page!

Without this property all mails will be listet, doesn't matter if there is the same mailformplus-Design is used.

Example:

plugin.tx_thmailformplus_pi2 {
   template = fileadmin/templates/mailformplus_kontakt_Kunig.html
   linkVars = <img src="fileadmin/images/lupe.gif" alt="lupe" width="14px" height="14px" />
   sourcePagePID = 43
}

Setting up a listing of submitted form data in frontend

  1. Create page and insert a “plugin” element on the page where the “list”-form should be shown – pluginname: “Mailformplus List” with the type of display “LIST”.

  2. Optional: Create (sub-)page and insert a “plugin” element on the page where the “single”-form should be shown – pluginname: “Mailformplus List” with the type of display “SINGLE” (remember the Id).

  3. If you have created a page for single view, enter the pid of this page in the settings of the plugin in the list view page.

  4. Create a template or copy the one from the “example_form” folder (fe-list_template.html) and configure the path via typoscript.

  5. This will be the content of the marker  ###LINK2SHOW###: plugin.tx_thmailformplus_pi2.linkVars = <img src="fileadmin/images/lupe.gif" alt="lupe" width="14px" height="14px" />

  6. If you do not want to write code for every form field to be displayed using the markers ###VALUE_[fieldname]### and ###LLL:[fieldname]###, you can use the subpart ###FIELD_REPEAT### in which you can use the markers ###title### and ###value###. This subpart will automatically get filled with any formfield title and value. If a marker ###VALUE_[fieldname]### for a specific field is used in the template, this field will not be automatically displayed in the subpart. This means you can have markers in this subpart being matched with a form field. All unmatched form fields will be processed by replacing the “title” and “value” markers in a loop.