DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
EXT: Universal Formhandler¶
Author: | Kasper Skårhøj |
---|---|
Created: | 2002-11-01T00:32:00 |
Changed: | 2009-07-20T12:36:08 |
Classification: | mailformplusplus |
Description: | The keywords help with categorizing and tagging of the manuals. You can combine two or more keywords and add additional keywords yourself. Please use at least one keyword from both lists. If your manual is NOT in english, see next tab "language" ---- forEditors (use this for editors / german "Redakteure") forAdmins (use this for Administrators) forDevelopers (use this for Developers) forBeginners (manuals covering TYPO3 basics) forIntermediates (manuals going into more depth) forAdvanced (covering the most advanced TYPO3 topics) see more: http://wiki.typo3.org/doc_template#tags ---- |
Keywords: | forAdmins, forAdvanced |
Author: | Dev-Team Typoheads |
Email: | dev@typoheads.at |
Info 4: | |
Language: | en |
EXT: Universal Formhandler - mailformplusplus
EXT: Universal Formhandler¶
Extension Key: mailformplusplus
Language: en
Copyright 2008, Dev-Team Typoheads, <dev@typoheads.at>
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml
The content of this document is related to TYPO3
- a GNU/GPL CMS/Framework available from www.typo3.org
Table of Contents¶
`Introduction 3 <#1.1.Introduction|outline>`_
Comparison to th_mailformplus 4
`Users manual 7 <#1.2.Users%20manual|outline>`_
`Administration 8 <#1.3.Administration|outline>`_
How does this extension work? 8
`Configuration 9 <#1.4.Configuration|outline>`_
PreProcessor_LoadDefaultValues 12
PreProcessor_ClearTempFiles 13
Interceptor_RemoveXSS 14
Interceptor_Filtreatment 14
Interceptor_IPBlocking 14
Interceptor_ParseValues 15
Finisher_ClearCache 16
Finisher_Redirect 16
Finisher_StoreUploadedFiles 16
Finisher_Confirmation 17
Finisher_DB 18
Finisher_DifferentDB 19
Finisher_Mail 20
Example 23
Available subparts to use in the template 23
Available markers to use in subparts 24
`Tutorial 26 <#1.5.Tutorial|outline>`_
How to set up a simple form 26
How to set up an advanced form 26
How to use predefined forms 26
How to set up a multistep form 26
How to set up a multistep form with conditions 27
How to set up spam protection 27
Enable captcha for your form 27
Enable sr_freecap for your form 27
Enable jm_recaptcha for your form 28
Enable mathGuard for your form 28
How to fill your own markers via TypoScript 29
`How to hide unfilled form field values in templates 30 <#1.5.8.How%20 to%20hide%20unfilled%20form%20field%20values%20in%20templates|outline> `_
How to set up multi language forms 31
How to load data from DB to use in Finisher_DB 31
How to use HTML as PDF template 32
How to upgrade from th_mailformplus to Mailformplus MVC 32
`Known problems 34 <#1.6.Known%20problems|outline>`_
`To-Do list 35 <#1.7.To-Do%20list|outline>`_
`ChangeLog 36 <#1.8.ChangeLog|outline>`_
Introduction¶
This extension was initially developed by Reinhard Führicht for Typoheads ( www.typoheads.at ). After the initial upload to Forge, the development team got enriched by Fabien Udriot and Johannes Feustel. If you want to participate, report bugs or demand additional features please use the possibilities of Forge (forge.typo3.org).
If you like this extension and want to encourage development of new features, feel free to write an email to office(at) typoheads.at to receive details about donation process.
What does it do?¶
When you reach the limits of the standard mailform functionality of TYPO3 (especially when you want the form to look special) you can use this extension to use your conventional HTML-forms (as HTML-snippets) with full mailform functionality.
This extension is considered as the follow-up to th_mailformplus, including nearly all the features of th_mailformplus and many more new features having a completely new architecture and code. The result is a very flexible approach to form handling.
The new architecture and TypoScript configuration makes it possible to easily control the processing of the form by adding an infinite number of validators and interceptors to filter form input. After successful form submission you can add special interceptors to sanitize input values for final processing in the so called “finishers”. Finishers are used to save data into DB, send emails, redirect to another page, etc. Have a look at the available classes described in this manual. If you miss a feature, you can easily write your own class and plug it into MailformPlus MVC processing. After having read the manual and looked into the code documentation, you will see how your own classes can be integrated into MailformPlus MVC.
Please visit the extension's section on forge to post feature requests or report bugs.
http://forge.typo3.org/projects/show/extension-mailformplusplus
Note : This extension requires PHP 5.2 or higher and the extension “gimmefive” from Jochen Rau.
Features¶
- HTML-Template based
- Server side error checks
- Send submitted values as e-mail
- Redirect to a page after successful submission
- Store submitted data in DB
- Captcha support (captcha, sr_freecap, jm_recaptcha, mathguard, wt_calculating_captcha)
- Multipage forms
- HTML mails, plain text mails, multipart mails (HTML+plain)
- File upload handling
- Multipage forms with conditions (branches)
- Frontend listing of submitted data
- Frontend multilanguage support
- Backend module to manage and export submitted data (PDF,CSV)
- ...
Goals¶
This extension's architecture is designed to be as modular as possible making it easy to perform changes and add new features. As every form needs different configuration than another form, there are many different “blocks” which can be stuck together fulfilling almost all needs.
Comparison to th_mailformplus¶
Mailformplus MVC is considered a follow-up to th_mailformplus. th_mailformplus has started with a very basic feature set and has grown to a huge extension over the years. The code got kind of unmaintainable and it was time to change the architecture to be quicker spotting and fixing bugs and to offer a whole new experience of flexibility. For a guide on how to upgrade TypoScript configuration from th_mailformplus to Mailformplus MVC have a look at the section “H ow to upgrade from th_mailformplus to Mailformplus MVC ”.
First of all Mailformplus MVC has a more up-to-date architecture, which allows a more modular approach having different classes for different tasks. Another advantage of this architecture is a smaller code base making updates and adding of additional features much less time consuming.
Compared to th_mailformplus Mailformplus MVC offers much more flexibility. The modular approach allows the user to add an infinite number of either predefined or self written classes to processing (PreProcessors, Interceptors, Validators, Finishers). When you are not satisfied with the features Mailformplus MVC has to offer, you can easily write your own class and add it to the rendering process without changing a single line in the PHP code of Mailformplus MVC.
Have a look at the section “How does this extension work?” and the TypoScript configuration options. For a more practical way of explanation, have a look at the “How to ...” sections at the end of the manual or the folder “Examples” in the extension directory.
Screenshots¶
This is how MailformPlusPlus works. Quite simple, isn't it? For more information about the rendering process have a look at the section “How does this extension work?”.
The Plugin view of MailformPlusPlus. The user can choose a template file and a translation file. Furthermore the user can enter settings for E-mail submission and redirection.
A form generated with MailformPlusPlus having file uploads handling and error checks.
Users manual¶
Create template¶
To create a form using MailformPlusPlus you will first have to write a HTML template file containing the code of your form. You will have to follow certain rules, so that MailformPlusPlus will be able to detect the suitable subparts for each situation. For an overview of how to create a form template have a look at the sections “ How to set up a simple form ” and “ Available markers to use in subparts ” or check the demo templates located at EXT:mailformplusplus/Examples/
Create translation file¶
In order to use error messages for your fields and to be able to use multilanguage labels, you have to write a translation file. We decided to make translation files kind of obligatory because it's just nicer. So if you want your form to be fully functional, we recommend to use a translation file. A little tutorial on how to use those translations is in section “ How to set up multilanguage forms ”.
Create a Plugin Record¶
Create a new page and create a content element. Choose type “General plugin”. In the section “Plugin” now choose “MailFormPlusPlus” as plugin type. Now you are able to select your template file and translation file as well as setting options for e-mail sending, basic “required” error checks and a redirect page after successful submission of the form. When creating a new record, the default predefined form is selected. To add your own predefined form, you should add a new TypoScript template.
Enter your options and save.
Create a TypoScript setup¶
If you want to use the whole power of MailformPlusPlus you should use TypoScript to configure your form. Many different examples are available at EXT:mailformplusplus/Examples/
Tips and tricks: It is sometimes more convenient to edit the TypoScript in an external file. This is particularly true for big typoscript chunk. To do this, insert in a suitable typoscript template (can be the root or a local TS template):
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/templates/mailform/setup.ts">
Then, you could add this line to your user profile / group to avoid clearing the cache all the time.
admPanel.override.tsdebug.forceTemplateParsing = 1
Include static¶
Don't forget to include the MailformPlusPlus static setup in your root template!
FAQ¶
Feel free to contribute on http://forge.typo3.org/projects/extension- mailformplusplus/issues
Administration¶
Not much to say here. Have a look at the sections “ Available subparts to use in the template ”, “ Available markers to use in subparts ”, the TypoScript reference and the available error checks and you will be fine.
For better understanding the rendering process of this extension will be explained in more detail.
How does this extension work?¶
The process of rendering a form got simplified to the following simple tasks:
Preprocessing:
Do some work before the form is shown, when the page is loaded for the first time (no submission took place). This can be used to load default values for fields or other tasks.
Intercepting:
Before the form is shown, there may be a need to intercept and do something with the previously entered data. Mailformplus MVC uses this for doing XSS checks. Mailformplus MVC knows two types of interceptors, InitInterceptors and SaveInterceptors. InitInterceptors are called everytime before the form is shown, SaveInterceptors are called when the form got submitted successfully right before the Finishers are called.
Validating:
After form submission there has to be a possibility to validate the input.
Finishing
After successful form submission there may be several tasks to perform, such as saving the input data to database or sending emails.
Any of these mentioned tasks can take more than one class that are called seperately.
A little example:
finishers {
1 {
class = Finisher_DB
config {
...
}
}
2 {
class = Finisher_Mail
config {
...
}
}
3 {
class = Finisher_Redirect
config {
...
}
}
}
As you see, there are several Finishers defined, which perform different tasks. It is kind of a Finisher chain, so that any number of tasks can be performed. The first Finisher will store the submitted data into a defined database table, the second will send emails to users or administrators, the third will redirect to another page. The idea of creating chains of classes is also possible for PreProcessors, Interceptors and Validators.
Configuration¶
Reference¶
Important Note:
MailformPlusPlus requires to enter class names of components to perform different tasks.
Example:
finishers.1.class = F3_MailformPlusPlus_Finisher_Mail
To make the usage easier, it is not needed to prefix the classes with F3_MailformPlusPlus_ in TypoScript:
finishers.1.class = Finisher_Mail
General Options¶
templateFile¶
Property
templateFile
Data type
String / TS object
Description
Path to template file or template code
Default
langFile¶
Property
langFile
Data type
String / TS object
Description
Path to language file or language code
Default
stylesheetFile¶
Property
stylesheetFile
Data type
String
Description
Path to stylesheet file
Default
formValuesPrefix¶
Property
formValuesPrefix
Data type
String
Description
Enter a prefix of the form values. MailformPlusPlus will then only process fields named like prefix[fieldname] in the HTML template, but lets you enter the fieldnames in config without the prefix. Avoid disturbances with other extensions by prefixing your form fields.
Default
view¶
Property
view
Data type
String
Description
Classname of the view to be used
Default
F3_MailformPlusPlus_View_Default
controller¶
Property
controller
Data type
String
Description
Classname of the controller to be used
Default
F3_MailformPlusPlus_Controller_Default
formValuesPrefix¶
Property
formValuesPrefix
Data type
String
Description
Prefix of form fields. Use this if you use a prefix for your forms to avoid conflicts with other plugins. Settings this option you will be able to use only the fieldname in all markers and do not need to add prefix.
NOTE: It is highly recommended to use this setting!
Example:
<input type="text" name="mailformplusplus[email]" value="###value_email###" />
If you do not set formValuesPrefix, you will not be able to use the marker
###value_email###.
Default
debug¶
Property
debug
Data type
Boolean (0,1)
Description
Toggle debug mode, which will print debug messages to screen
Default
0
storeGP¶
Property
storeGP
Data type
Boolean
(0,1)
Description
If set, stores the GET / POST variables in the session. May be useful for using those values on an other page. Automatically runs Finisher_StoreGP.
Default
0
requiredSign¶
Property
requiredSign
Data type
String
Description
Enter some text which will be used to substitute markers like ###required_[fieldname]###.
Default
*
singleErrorTemplate.totalWrap¶
Property
singleErrorTemplate.totalWrap
Data type
wrap
Description
Enter something to be wrapped around the error messages of a single form field.
Default
singleErrorTemplate.singleWrap¶
Property
singleErrorTemplate.singleWrap
Data type
wrap
Description
Enter something to be wrapped around each error message of a single form field.
Default
singleErrorTemplate.addDefaultMessage¶
Property
singleErrorTemplate.addDefaultMessage
Data type
Boolean
Description
Adds the error message found in 'error_[fieldname]' in the language file at any time.
Default
errorListTemplate.totalWrap¶
Property
errorListTemplate.totalWrap
Data type
wrap
Description
Enter something to be wrapped around the error message list of all form fields.
Default
errorListTemplate.singleWrap¶
Property
errorListTemplate.singleWrap
Data type
wrap
Description
Enter something to be wrapped around the error messages of a single form field in the list of all form fields.
Default
singleFileMarkerTemplate.totalWrap¶
Property
singleFileMarkerTemplate.totalWrap
Data type
wrap
Description
Enter something to be wrapped around the full list of filenames in a file marker for a single form field.
Default
singleFileMarkerTemplate.singleWrap¶
Property
singleFileMarkerTemplate.singleWrap
Data type
wrap
Description
Enter something to be wrapped around each filename in a file marker for a single form field.
Default
singleFileMarkerTemplate.showThumbnails¶
Property
singleFileMarkerTemplate.showThumbnails
Data type
Boolean (0/1)
Description
Shows thumbnail of uploaded file instead of filename
Default
0
singleFileMarkerTemplate.image¶
Property
singleFileMarkerTemplate.image
Data type
IMAGE
Description
IMAGE object for thumbnail generation. Image.file gets inserted by Mailformplus MVC
Default
totalFilesMarkerTemplate.totalWrap¶
Property
totalFilesMarkerTemplate.totalWrap
Data type
wrap
Description
Enter something to be wrapped around the full list of filenames in a file marker for all form fields.
Default
totalFilesMarkerTemplate.singleWrap¶
Property
totalFilesMarkerTemplate.singleWrap
Data type
wrap
Description
Enter something to be wrapped around each filename in a file marker for all form fields.
Default
totalFilesMarkerTemplate.showThumbnails¶
Property
totalFilesMarkerTemplate.showThumbnails
Data type
Boolean (0/1)
Description
Shows thumbnail of uploaded file instead of filename
Default
0
files.uploadFolder¶
Property
files.uploadFolder
Data type
String
Description
Path to a custom upload folder
Default
uploads/mailformplusplus/tmp
files.enableAjaxFileRemoval¶
Property
files.enableAjaxFileRemoval
Data type
Boolean (0/1)
Description
Adds a remove link to every filename in ###[fieldname]_uploadedFiles### and ###total_uploadedFiles###. Unfortunately other markers like ###[fieldname]_fileCount### will not be updated at the moment.
Default
markers.[markername]¶
Property
markers.[markername]
Data type
mixed
Description
Define your own custom markers and fill them using TypoScript.
Default
checkBoxFields¶
Property
checkBoxFields
Data type
String
Description
Comma seperated list of field names which contain checkbox values. This is needed for multipage forms in order to ensure correct submission of these values from step to step. Please enter all checkbox field names in here. Set this option per step.
Example:
plugin.F3_MailformPlusPlus.settings {
# Checkbox fields in step 1
1.checkBoxFields = interests, hobbies
# Checkbox fields in step 2
2.checkBoxFields = work_experience,accounts
}
Default
radioButtonFields¶
Property
radioButtonFields
Data type
String
Description
Comma seperated list of field names which contain radio button values. This is needed for multipage forms in order to ensure correct submission of these values from step to step. Please enter all radio button field names in here. Set this option per step.
Example:
plugin.F3_MailformPlusPlus.settings {
# Radiobutton fields in step 1
1.radioButtonFields = contact_via
# Radiobutton fields in step 2
2. radioButtonFields = receive_gift
}
Default
addErrorAnchors¶
Property
addErrorAnchors
Data type
Boolean (0/1)
Description
If you use ###error### and error markers for each field, you can enable
this settings to add anchor links to each message in ###error###. The
anchors will point to the messages in ###error_[fieldname]###.
Default
predef¶
Property
predef
Data type
Array
Description
Predefine form settings and make them selectable in plugin record.
Have a look at the section “H ow to use predefined forms”
Default
isErrorMarker¶
Property
isErrorMarker
Data type
array
Description
Configure replacements for ###is_error_[fieldname]### markers.
Example
plugin.F3_MailformPlusPlus.settings {
isErrorMarker {
global = Global message if an error occurred (filled into ###is_error###)
field1 = TEXT
field1.value = Some message (filled into ###is_error_field1###)
}
}
Default
[plugin.F3_MailformPlusPlus .settings]
Loggers¶
x.class¶
Property
x.class
Data type
String
Description
Enter as many loggers as you like. Each entry requires a class name of the logger. Optional you can enter specific configuration for the logger in the confg section.
Example:
loggers.1 {
class = F3_MailformPlusPlus_Logger_Default
}
loggers.2 {
class = F3_MyPackage_Logger
config {
table = tx_mypackage_log
}
}
Default
x.config¶
Property
x.config
Data type
Array
Description
[plugin.F3_MailformPlusPlus .settings.loggers]
PreProcessors¶
x.class¶
Property
x.class
Data type
String
Description
Enter as many pre processors as you like. Each entry requires a class name of the pre processor. Optional you can enter specific configuration for the pre processor in the confg section. The pre processors are called only the first time the form is shown.
Example:
preProcessors.1 {
class = F3_MailformPlusPlus_PreProcessor_Default
}
preProcessors.2 {
class = F3_MyPackage_ PreProcessor
config {
param = value
}
}
Default
x.config¶
Property
x.config
Data type
Array
Description
[plugin.F3_MailformPlusPlus .settings.preProcessors]
PreProcessor_LoadDefaultValues¶
Prefills form fields with configured values.
Config is done for each step and for each form field.
Example:
preProcessors {
1.class = F3_MailformPlusPlus_PreProcessor_LoadDefaultValues
1.config {
1 {
tile.defaultValue = {$local.mailform.title}
lastname.defaultValue = Firstname in here
firstname.defaultValue = TEXT
firstname.defaultValue.value = Lastname in here
}
2 {
creditcard.defaultValue = Enter your credit card number here
}
}
}
[
plugin.F3_MailformPlusPlus.settings.preProcessors.x.class = F3_MailformPlusPlus_PreProcessor_LoadDefaultValues
plugin.F3_MailformPlusPlus.settings.preProcessors.x.config.[x].[field name].
]
Property
defaultValue
Data type
String | TypoScript Object
Description
Field will be filled with this default value
Default
PreProcessor_ClearTempFiles¶
Clears temporary uploaded files older than a specified time.
Example:
preProcessors {
1.class = F3_MailformPlusPlus_PreProcessor_ClearTempFiles
1.config {
clearTempFilesOlderThan {
value = 24
unit = hours
}
}
}
[
plugin.F3_MailformPlusPlus.settings.preProcessors.x.class = F3_MailformPlusPlus_PreProcessor_ClearTempFiles
plugin.F3_MailformPlusPlus.settings.preProcessors.x.config.[x].[field name].
]
Property
clearTempFilesOlderThan.value
Data type
int
Description
Value of the time
Default
Property
clearTempFilesOlderThan.unit
Data type
string
Description
Unit of the time. Values may be minutes, hours or days
Default
hours
Interceptors¶
x.class¶
Property
x.class
Data type
String
Description
Enter as many interceptors as you like. Each entry requires a class name of the interceptor. Optional you can enter specific configuration for the interceptor in the confg section. The init interceptors are called everytime before the form is shown.
Example:
initInterceptors.1 {
class = F3_MailformPlusPlus_Interceptor_RemoveXSS
}
initInterceptors.2 {
class = F3_MyPackage_ Interceptor
config {
param = value
}
}
Default
x.config¶
Property
x.config
Data type
Array
Description
[plugin.F3_MailformPlusPlus.settings.initInterceptors]
x.class¶
Property
x.class
Data type
String
Description
Enter as many interceptors as you like. Each entry requires a class name of the interceptor. Optional you can enter specific configuration for the interceptor in the confg section. The save interceptors are called before the finishers are executed.
Example:
saveInterceptors.1 {
class = F3_MailformPlusPlus_Interceptor_Default
}
saveInterceptors.2 {
class = F3_MyPackage_ Interceptor
config {
param = value
}
}
Default
x.config¶
Property
x.config
Data type
Array
Description
[plugin.F3_MailformPlusPlus.settings.saveInterceptors]
Interceptor_RemoveXSS¶
Removes malicious code from submitted values to prevent XSS. No further configuration required!
This class experiences some problems with special characters such as German Umlauts.
Example:
plugin.F3_MailformPlusPlus.settings.initInterceptors.1.class = F3_MailformPlusPlus_Interceptor_RemoveXSS
Interceptor_Filtreatment¶
Removes malicious code from submitted values to prevent XSS. No further configuration required!
In the opinion of the author, this class does a better job than Interceptor_RemoveXSS.
Example:
plugin.F3_MailformPlusPlus.settings.initInterceptors.1.class = F3_MailformPlusPlus_Interceptor_Filtreatment
Interceptor_IPBlocking¶
If you do not want to use Captcha for your form, you can control how often the form is allowed to be submitted by a single IP address or in total with this class.
[
plugin.F3_MailformPlusPlus.settings.initInterceptors.x.class = F3_MailformPlusPlus_Interceptor_IPBlocking
plugin.F3_MailformPlusPlus.settings.initInterceptors.x.config.
]
Property
redirectPage
Data type
int/string
Description
Page ID or URL to redirect to. If a user is blocked from submiting the form, he gets redirected to this page.
Default
Property
report
Data type
array
Description
If a user gets blocked from submitting the form, a report email is sent to the configured recipient.
Default
Property
report.email
Data type
string
Description
Comma seperated list of recipients.
Default
Property
report.subject
Data type
string
Description
Subject of the report mail
Default
Property
report.sender
Data type
string
Description
Email address to be set as sender of the report mail.
Default
Property
report.interval
Data type
array
Description
To prevent the recipient of the report mails to get spammed with report mails, you can configure the interval. A report mail will be sent only once during the interval for a single alert.
Default
Property
report.interval.value
Data type
int
Description
Value
Default
Property
report.interval.unit
Data type
string
Description
And unit for the interval.
Unit can be seconds,minutes,hoursand days
Default
Property
ip
Data type
array
Description
Settings for limiting submission for an IP address
Default
Property
ip.threshold
Data type
int
Description
The amount of submissions for an IP address in the given period of time
Default
Property
ip.timebase.value
Data type
int
Description
Value
Default
Property
ip.timebase.unit
Data type
string
Description
And unit for the mentioned period of time
Unit can be seconds,minutes,hoursand days
Default
Property
global
Data type
array
Description
Settings for limiting submissions for a form.
SAME SETTINGS AS FOR IP.
Default
Interceptor_ParseValues¶
Parse formatted values. Currently only floats such as "1.022.000,76 EUR". See unittest file for detailed examples. Attention: x.xxx.xxx gets parsed to xxxxxxx but xx.xx to xx.xx.
[
plugin.F3_MailformPlusPlus.settings.saveInterceptors.x.class = F3_MailformPlusPlus_Interceptor_ParseValues
plugin.F3_MailformPlusPlus.settings.saveInterceptors.x.config.
]
Property
parseFloatFields
Data type
string
Description
Comma seperated list of fields to parse.
Default
Interceptor_AntiSpamFormTime¶
Spam protection for the form withouth Captcha. It parses the time the user needs to fill out the form. If the time is below a minimum time or over a maximum time, the submission is treated as Spam.
If Spam is detected you can redirect the user to a custom page or use the Subpart ###TEMPLATE_ANTISPAM### to just display something.
IMPORTANT: You will need a form field named “formtime” containing a timestamp in your form. To do this you can use the marker ###TIMESTAMP###.
Example:
<input type=”hidden” name=”mailformplusplus[formtime]” value=”###TIMESTAMP###” />
[
plugin.F3_MailformPlusPlus.settings.saveInterceptors.x.class = F3_MailformPlusPlus_Interceptor_AntiSpamFormTime
plugin.F3_MailformPlusPlus.settings.saveInterceptors.x.config.
]
Property
minTime.value
Data type
int
Description
value
Default
Property
minTime.unit
Data type
string
Description
unit for the minimum time.
Unit can be seconds,minutes,hoursand days
Default
Property
maxTime.value
Data type
int
Description
value
Default
Property
maxTime.unit
Data type
string
Description
unit for the minimum time.
Unit can be seconds,minutes,hoursand days
Default
Property
redirectPage
Data type
mixed
Description
Page ID or URL to redirect in case Spam is detected
Default
Validators¶
x.class¶
Property
x.class
Data type
String
Description
Enter as many validators as you like. Each entry requires a class name of the validator. Optional you can enter specific configuration for the validator in the confg section. For detailed information about the default validator settings have a look at the section “Available error checks”.
Example:
validators.1 {
class = F3_MailformPlusPlus_Validator_Default
/*
* Some times you maybe want to disable error checks if the user
* filled out a specific fields or else.
* Temporary disable error checking for the entered fields by setting
* this option.
*/
disableErrorCheckFields = firstname,lastname
config {
fieldConf {
firstname.errorCheck {
1 = required
2 = maxLength
2.value = 20
}
email.errorCheck {
1 = required
2 = email
}
}
}
}
validators.2 {
class = F3_MyPackage_ Validator
config {
param = value
}
}
Default
x.config¶
Property
x.config
Data type
Array
Description
[plugin.F3_MailformPlusPlus.settings.validators]
Have a look at the section " Available error checks "
Finishers¶
x.class¶
Property
x.class
Data type
String
Description
Enter as many finishers as you like. Each entry requires a class name of the finisher. Optional you can enter specific configuration for the finisher in the confg section. For more information about available finishers and their settings have a look at the section “Available finishers”.
Example:
finishers.1 {
class = F3_MailformPlusPlus_Finisher_Mail
config {
admin {
to_email = rf@typoheads.at
to_name = Reinhard Führicht
subject = Request
sender_email = contactform@mysite.com
replyto_email = email
replyto_name = name
}
user {
to_email = email
to_name = name
subject = ###LLL:user_subject###
sender_email = contactform@mysite.com
sender_name = My Site
replyto_email = contactform@mysite.com
}
}
}
finishers.2 {
class = F3_MailformPlusPlus_Finisher_Default
config {
}
}
Default
x.config¶
Property
x.config
Data type
Array
Description
[plugin.F3_MailformPlusPlus.settings.finishers]
Finisher_ClearCache¶
Clear the cache of the current page. It needs no further configuration.
Finisher_Redirect¶
Redirects to specified page after successful form submission.
[
plugin.F3_MailformPlusPlus.settings.finishers.x.class = F3_MailformPlusPlus_Finisher_Redirect
plugin.F3_MailformPlusPlus.settings.finishers.x.config.
]
Property
redirectPage
Data type
int/string
Description
Page ID or URL to redirect to
Default
Property
correctRedirectUrl
Data type
Int (1/0)
Description
Replaces '&' with '&' in URL
Default
0
Finisher_StoreUploadedFiles¶
Moves uploaded files from temporary folder to a new one and renames them if set.
[
plugin.F3_MailformPlusPlus.settings.finishers.x.class = F3_MailformPlusPlus_Finisher_StoreUploadedFiles
plugin.F3_MailformPlusPlus.settings.finishers.x.config.
]
Property
finishedUploadFolder
Data type
string
Description
Path where to store the files
Default
Property
renameScheme
Data type
string
Description
Specifiy how the files should be renamed.
Example:
renameScheme = [pid]_[filename]
Possbile options:
[pid] = The current page id
[md5] = md5 hash over filename
[time] = The submission time stamp
[filename] = Original Filename
[xxx] = Your own marker defined in “schemeMarkers”
Default
Property
schemeMarkers
Data type
array
Description
Define your own markers to be used in rename scheme.
Example:
renameScheme = [mymarker]_[marker2]_[filename]
schemeMarkers {
mymarker = TEXT
mymarker.value = asdf
marker2 = fieldValue
marker2.field = field1
}
Default
Finisher_Confirmation¶
Shows an overview of submitted data and links to save the data as PDF or CSV. Also shows a print link.
To configure how the output looks like you have to add a special subpart to your HTML template.
Example:
<!-- ###TEMPLATE_CONFIRMATION### begin -->
<table>
<tr>
<td>###LLL:firstname###</td>
<td>###value_firstname###</td>
</tr>
</table>
<div>
###PRINT_LINK### / ###PDF_LINK### / ###CSV_LINK###
</div>
<!-- ###TEMPLATE_CONFIRMATION### end -->
[
plugin.F3_MailformPlusPlus.settings.finishers.x.class = F3_MailformPlusPlus_Finisher_Confirmation
plugin.F3_MailformPlusPlus.settings.finishers.x.config.
]
Property
returns
Data type
Int (1/0)
Description
MUST be set. Tells the controller that after this finisher, no other finishers can be called!
Default
Property
Data type
array
Description
Settings for the PDF generation
Default
Property
pdf.class
Data type
string
Description
The class to handle PDF generation.
Except you write your own class, use: F3_MailformPlusPlus_Generator_PDF or F3_MailformPlusPlus_Generator_TCPDF
Default
F3_MailformPlusPlus_Generator_PDF
Property
pdf.exportFields
Data type
string
Description
Comma seperated list of fields to export to PDF.
Example:
firstname,lastname,email
Default
All submitted fields
Property
pdf.export2file
Data type
Int (1/0)
Description
Saves PDF into a temporary file and redirects to it.
If not set , the PDF is kept in memory.
Default
0
Property
csv
Data type
array
Description
Settings for the CSV generation
Default
Property
csv.class
Data type
string
Description
The class to handle CSV generation.
Except you write your own class, use: F3_MailformPlusPlus_Generator_CSV
Default
F3_MailformPlusPlus_Generator_CSV
Property
csv.exportFields
Data type
string
Description
Comma seperated list of fields to export to CSV.
Example:
firstname,lastname,email
Default
Finisher_DB¶
Saves submitted values into specified DB table.
[
plugin.F3_MailformPlusPlus.settings.finishers.x.class = F3_MailformPlusPlus_Finisher_DB
plugin.F3_MailformPlusPlus.settings.finishers.x.config.
]
Property
table
Data type
string
Description
The table name to store the data into
Default
Property
key
Data type
string
Description
The field with primary key
Example:
key = uid
Default
uid
Property
updateInsteadOfInsert
Data type
int(1/0)
Description
Does not store the values as a new row in the table, but tries to update an existing record.
Needs a uid set in GET/POST parameters.
Add a hidden field named like the value entered in “key” to your form. Don't forget to add the formValuePrefix!
Default
0
Property
fields
Data type
array
Description
Mapping of table fields to submitted values.
Usage:
fields {
[db_field].mapping = [form_field]
}
Example:
fields {
header.mapping = name
}
Default
Property
fields.[db_field].ifIsEmpty
Data type
string
Description
Define a default value if the user did not enter something in the form field
Default
Property
fields.[db_field].seperator
Data type
string
Description
If the field value is an array 8e.g. Checkboxes) you can enter a seperator to save the value imploded into DB.
Default
,
Property
fields.[db_field].special
Data type
string
Description
There are some special values available:
sub_datetime
sub_tstamp
ip
Should not need further explanation.
Default
Property
fields.[db_field].preProcessing
Data type
TS object
Description
Preprocess the value before saving into database
Example:
fields {
header {
preProcessing = USER
preProcessing.userFunc = user_helper->appendSomething
mapping = firstname
}
}
Default
Property
fields.[db_field].postProcessing
Data type
TS object
Description
Postprocess the value before saving into database. Enables you to override processing of Mailformplus MVC, if you are not satisfied with it.
Example:
fields {
header {
postProcessing = USER
postProcessing.userFunc = user_helper->appendSomething
mapping = firstname
}
}
Default
Finisher_DifferentDB¶
Saves submitted values into specified DB table using a database other than the TYPO3 database.
[
plugin.F3_MailformPlusPlus.settings.finishers.x.class = F3_MailformPlusPlus_Finisher_DifferentDB
plugin.F3_MailformPlusPlus.settings.finishers.x.config.
]
Property
host
Data type
string
Description
Host of the databse
Default
Property
port
Data type
string
Description
Port to use
Default
Property
db
Data type
string
Description
Name of the databse
Default
Property
driver
Data type
string
Description
Driver to use
Example:
driver = oci8
Default
Property
username
Data type
string
Description
Username for DB
Default
Property
password
Data type
string
Description
Password for DB user
Default
Property
table
Data type
string
Description
The table name to store the data into
Default
Property
key
Data type
string
Description
The field with primary key
Example:
key = uid
Default
uid
Property
updateInsteadOfInsert
Data type
int(1/0)
Description
Does not store the values as a new row in the table, but tries to update an existing record.
Needs a uid set in GET/POST parameters.
Add a hidden field named like the value entered in “key” to your form. Don't forget to add the formValuePrefix!
Default
0
Property
fields
Data type
array
Description
Mapping of table fields to submitted values.
Usage:
fields {
[db_field].mapping = [form_field]
}
Example:
fields {
header.mapping = name
}
Default
Property
fields.[db_field].ifIsEmpty
Data type
string
Description
Define a default value if the user did not enter something in the form field
Default
Property
fields.[db_field].seperator
Data type
string
Description
If the field value is an array 8e.g. Checkboxes) you can enter a seperator to save the value imploded into DB.
Default
,
Property
fields.[db_field].special
Data type
string
Description
There are some special values available:
sub_datetime
sub_tstamp
ip
Should not need further explanation.
Default
Property
fields.[db_field].preProcessing
Data type
TS object
Description
Preprocess the value before saving into database
Example:
fields {
header {
preProcessing = USER
preProcessing.userFunc = user_helper->appendSomething
mapping = firstname
}
}
Default
Property
fields.[db_field].postProcessing
Data type
TS object
Description
Postprocess the value before saving into database. Enables you to override processing of Mailformplus MVC, if you are not satisfied with it.
Example:
fields {
header {
postProcessing = USER
postProcessing.userFunc = user_helper->appendSomething
mapping = firstname
}
}
Default
Finisher_Mail¶
Sends emails to specified addresses using following subparts in the HTML template:
- TEMPLATE_EMAIL_USER_PLAIN
- TEMPLATE_EMAIL_USER_HTML
- TEMPLATE_EMAIL_ADMIN_PLAIN
- TEMPLATE_EMAIL_ADMIN_HTML
[
plugin.F3_MailformPlusPlus.settings.finishers.x.class = F3_MailformPlusPlus_Finisher_Mail
plugin.F3_MailformPlusPlus.settings.finishers.x.config.
]
Property
limitMailstoUser
Data type
int
Description
Limit the amount of mails sent to users. If more addresses are specified than this value, emails are sent only to the first x recipients.
Default
unlimited
Property
checkBinaryCrLf
Data type
string
Description
Comma seperated list of fields. Converts chr(13) line breaks to <br/>
Default
uid
Property
admin
Data type
array
Description
Settings for the mail sent to site admin
Default
Property
admin.header
Data type
string
Description
Manually set the email header.
All options can be strings, TypoScript objects or names of form fields.
Default
Property
admin.to_email
Data type
string
Description
Comma seperated list of email addresses. Can be addresses or form fields.
Default
Property
admin.to_name
Data type
string
Description
Comma seperated list of names to the according addresses in to_email. Can be name or form fields.
Default
Property
admin.replyto_email
Data type
string
Description
Reply to email address
Default
Property
admin.replyto_name
Data type
string
Description
Name of the according replyto_email
Default
Property
admin.cc_email
Data type
string
Description
A CC email will be sent to this address.
Default
Property
admin.sender_email
Data type
string
Description
Email address to be set as sender of the email. Can be addresses or form fields.
Default
Property
admin.sender_name
Data type
string
Description
Name of the email sender. Can be name or form fields.
Default
Property
admin.subject
Data type
string
Description
Subject of the email
Default
Property
admin.attachment
Data type
string
Description
Comma seperated list of form fields or file names to be attached to the email.
Default
Property
admin.attachPDF
Data type
array
Description
Attach the submitted values as PDF
Default
Property
admin.attachPDF.class
Data type
string
Description
Class to handle the PDF generation. Normally this will be F3_MailformPlusPlus_Generator_PDF or F3_MailformPlusPlus_Generator_TCPDF
Default
F3_MailformPlusPlus_Generator_PDF
Property
admin.attachPDF.exportFields
Data type
string
Description
Comma seperated list of form fields to export to PDF.
Default
All submitted fields
Property
admin.htmlEmailAsAttachment
Data type
int(1/0)
Description
Attach the generated HTML email to the outgoing email
Default
0
Property
admin.filePrefix
Data type
string|array
Description
Set the prefix of the generated PDF and HTML files attached to email. Use this setting as an array to set different prefixes for the two files.
Example:
admin.filePrefix = myForm
or for different prefixes:
admin.filePrefix {
html = myFormHTML
pdf = myFormPDF
}
Default
mailformplusplus_
Property
user
Data type
array
Description
Settings for the email sent to the user.
SAME SETTINGS AS FOR ADMIN
Default
Frontend Listing¶
view¶
Property
view
Data type
String
Description
Class name of the view to be used
Default
F3_MailformPlusPlus_View_Listing
templateFile¶
Property
templateFile
Data type
String
Description
Template file to be used
Default
pid¶
Property
pid
Data type
Integer
Description
The page ID to select the logged records from.
Default
table¶
Property
table
Data type
String
Description
The table the logged records are stored in
Default
orderby¶
Property
orderby
Data type
String
Description
Enter an ORDERBY statement
Example:
orderby = subheader DESC
Default
enableDelete¶
Property
enableDelete
Data type
Boolean (0/1)
Description
Enable the deletion of records in Frontend Listing. If set, the marker ###DELETE### will get replaced with a delete link.
Default
0
mapping¶
Property
mapping
Data type
Array
Description
Map db fields to fieldnames to use in markers.
Example:
mapping.header = name
Markers in Template:
###value_name###
mapping {
header = name
bodytext = subject
subheader = sub_datetime
crdate = sub_tstamp
tstamp = sub_tstamp
imagecaption = ip
}
Default
[plugin.F3_MailformPlusPlus.settings.fe_listing]
Available error checks¶
The default validator offers a variety of predefined error checks for the most common tasks. Here is a list of the checks and how to configure them:
required¶
Check
required
Description
Checks if a field is filled out
Parameters
none
Datatype
email¶
Check
Description
Checks if a field contains a valid email
Parameters
none
Datatype
integer¶
Check
integer
Description
Checks if a field contains a valid integer value
Parameters
none
Datatype
float¶
Check
float
Description
Checks if a field contains a valid float value
Parameters
none
Datatype
containsNone¶
Check
containsNone
Description
Checks if a field contains none of the configured values
Parameters
words
Datatype
comma seperated
containsOne¶
Check
containsOne
Description
Checks if a field contains at least one of the configured values
Parameters
words
Datatype
comma seperated
containsAll¶
Check
containsAll
Description
Checks if a field contains all of the configured values
Parameters
words
Datatype
comma seperated
equals¶
Check
equals
Description
Checks if a field equals the configured value
Parameters
word
Datatype
string
equalsField¶
Check
equalsField
Description
Checks if a field value equals another field value
Parameters
field
Datatype
string
notEqualsField¶
Check
notEqualsField
Description
Checks if a field value does not equal another field value
Parameters
field
Datatype
string
notDefaultValue¶
Check
notDefaultValue
Description
Checks if a field equals a default value set by a pre processor
Parameters
defaultValue
Datatype
string/TS object
minValue¶
Check
minValue
Description
Checks if the value of a field is at least the configured value
Parameters
value
Datatype
numeric
maxValue¶
Check
maxValue
Description
Checks if the value of a field is less than the configured value
Parameters
value
Datatype
numeric
minLength¶
Check
minLength
Description
Checks if the value of a field has at least the configured length
Parameters
value
Datatype
integer
maxLength¶
Check
maxLength
Description
Checks if the value of a field has less than the configured length
Parameters
value
Datatype
integer
betweenValue¶
Check
betweenValue
Description
Checks if the value of a field is between the configured values
Parameters
minValue
maxValue
Datatype
numeric
numeric
betweenLength¶
Check
betweenLength
Description
Checks if the length of the value of a field is between the configured values
Parameters
minValue
maxValue
Datatype
integer
integer
minItems¶
Check
minItems
Description
Checks if a field contains at least the configured amount of items (e.g. checkboxes)
Parameters
value
Datatype
integer
maxItems¶
Check
maxItems
Description
Checks if a field contains less than the configured amount of items (e.g. checkboxes)
Parameters
value
Datatype
integer
betweenItems¶
Check
betweenItems
Description
Checks if a field contains values between the configured amount of items (e.g. checkboxes)
Parameters
minValue
maxValue
Datatype
integer
integer
isInDBTable¶
Check
isInDBTable
Description
Checks if the value of a field is in a configured field in a configured table
Parameters
table
field
Datatype
string
string
isNotInDBTable¶
Check
isNotInDBTable
Description
Checks if the value of a field is not in a configured field in a configured table
Parameters
table
field
Datatype
string
string
ereg¶
Check
ereg
Description
Checks a field value using the configured regular expression
Parameters
value
Datatype
regexp
eregi¶
Check
eregi
Description
Checks a field value using the configured regular expression, but being case insensitive
Parameters
value
Datatype
regexp
pregMatch¶
Check
pregMatch
Description
Checks a field value using the configured perl regular expression
Parameters
value
Datatype
regExp
captcha¶
Check
captcha
Description
Checks if a field value equals the generated captcha string of the extension “captcha”
Parameters
none
Datatype
srFreecap¶
Check
srFreecap
Description
Checks if a field value equals the generated captcha string of the extension “sr_freecap”
Parameters
none
Datatype
jmRecaptcha¶
Check
jmRecaptcha
Description
Checks if a field value equals the generated captcha string of the extension “jm_recaptcha”
Parameters
Datatype
mathGuard¶
Check
mathGuard
Description
Checks if a field value equals the result of the generated question of MathGuard
Parameters
Datatype
dateRange¶
Check
dateRange
Description
Checks if a field value is between a configured date range
Parameters
pattern
min
max
Datatype
string
string
string
date¶
Check
date
Description
Checks if a field value is a valid date
Parameters
pattern
Datatype
string
time¶
Check
time
Description
Checks if a field value is a valid time
Parameters
pattern
Datatype
string
fileAllowedTypes¶
Check
fileAllowedTypes
Description
Checks if the filetype of an uploaded file is allowed
Parameters
allowedTypes
Datatype
comma seperated
fileMaxCount¶
Check
fileMaxCount
Description
Checks if the files uploaded from a field are less than the configured value
Parameters
maxCount
Datatype
integer
fileMinCount¶
Check
fileMinCount
Description
Checks if the files uploaded from a field are more than or equal the configured value
Parameters
minCount
Datatype
integer
fileMinSize¶
Check
fileMinSize
Description
Checks if the size of an uploaded file is at least the configured value (in Byte)
Parameters
minSize
Datatype
integer
fileMaxSize¶
Check
fileMaxSize
Description
Checks if the size of an uploaded file is at less than the configured value (in Byte)
Parameters
maxSize
Datatype
integer
fileRequired¶
Check
fileRequired
Description
Checks if a file has been uploaded from this field
Parameters
none
Datatype
((generated))¶
Example¶
plugin.F3_MailformPlusPlus.settings.validators.1 {
class = F3_MailformPlusPlus_Validator_Default
config {
fieldConf {
firstname.errorCheck.1 = required
firstname.errorCheck.2 = minLength
firstname.errorCheck.2.value = 4
firstname.errorCheck.3 = notDefaultValue
firstname.errorCheck.3.defaultValue = Enter firstname here
picture.errorCheck.1 = fileRequired
picture.errorCheck.2 = fileAllowedTypes
picture.errorCheck.2.allowedTypes = jpg,png,gif,tiff
}
}
}
Available subparts to use in the template¶
###TEMPLATE_FORM[1...x]###¶
a
###TEMPLATE_FORM[1...x]###
b
Subpart for form template of a form. The number specifies the step.
Single step forms will only contain ###TEMPLATE_FORM1### .
Example:
###TEMPLATE_FORM1### for first step
###TEMPLATE_FORM[1...x][SUFFIX]###¶
a
###TEMPLATE_FORM[1...x][SUFFIX]###
b
Subpart for form template of a multi step form with conditions. The number specifies the step and the suffix specifies the current route.
Example:
###TEMPLATE_FORM2_routea###
###TEMPLATE_FORM2_routeb###
###FORM_STARTBLOCK###¶
a
###FORM_STARTBLOCK###
b
Use this in multistep forms and put code being the same in all steps into this subpart. You can use the marker ###FORM_STARTBLOCK### in the following steps and it gets replaced with the content of the subpart ###FORM_STARTBLOCK### in step 1.
###FORM_ENDBLOCK###¶
a
###FORM_ENDBLOCK###
b
Use this in multistep forms and put code being the same in all steps into this subpart. You can use the marker ###FORM_ENDBLOCK### in the following steps and it gets replaced with the content of the subpart ###FORM_ENDBLOCK### in step 1.
###TEMPLATE_EMAIL_ADMIN_PLAIN###¶
a
###TEMPLATE_EMAIL_ADMIN_PLAIN###
b
This subpart contains the template for the plain text E-mail sent to the admin if configured.
###TEMPLATE_EMAIL_ADMIN_HTML###¶
a
###TEMPLATE_EMAIL_ADMIN_HTML###
b
This subpart contains the template for the HTML E-mail sent to the admin if configured.
###TEMPLATE_EMAIL_USER_PLAIN###¶
a
###TEMPLATE_EMAIL_USER_PLAIN###
b
This subpart contains the template for the plain text E-mail sent to the user if configured.
###TEMPLATE_EMAIL_USER_HTML###¶
a
###TEMPLATE_EMAIL_USER_HTML###
b
This subpart contains the template for the HTML E-mail sent to the user if configured.
###TEMPLATE_CONFIRMATION###¶
a
###TEMPLATE_CONFIRMATION###
b
If you use the confirmation view after successful form submission you can enter your template in this subpart.
###TEMPLATE_PDF###¶
a
###TEMPLATE_PDF###
b
Customize the look of generated frontend PDF files. Have a look at the section “ How to use HTML as PDF template ”
###TEMPLATE_ANTISPAM###¶
a
###TEMPLATE_ANTISPAM###
b
Subpart for Interceptor_AntiSpamFormTime.
###ISSET_[FIELDNAME]###¶
a
###ISSET_[FIELDNAME]###
b
Use this subpart in your E-mail and confirmation templates to not show fields that were not filled out in the form. There is a how to section in this manual.
Available markers to use in subparts¶
###value_[fieldname]###¶
a
###value_[fieldname]###
b
GET/POST value of the given inputfield.
Example:
<input type=”text” name=”email” value=”###value_email###” />
###LLL:[langkey]###¶
a
###LLL:[langkey]###
b
Marker for translated texts. [langkey] is a key in your translation file.
###error_[fieldname]###¶
a
###error_[fieldname]###
b
This marker gets replaced with the error messages for the field
###is_error_[fieldname]###¶
a
###is_error_[fieldname]###
b
Only gets replaced when an error occurred in this fields. Can be filled with translated content or TypoScript objects. Have a look at the tutorial section for more information.
###is_error###¶
a
###is_error###
b
Only gets replaced when an error occurred in the form. Can be filled with translated content or TypoScript objects. Have a look at the tutorial section for more information.
###REL_URL###¶
a
###REL_URL###
b
Relative URL to current page
###ABS_URL###¶
a
###ABS_URL###
b
Absolute URL to current page
###submit_nextStep###¶
a
###submit_nextStep###
b
Use this in multi step forms to add a submit button pointing to the next step.
Example:
<input type”submit” ###submit_nextStep### value=”###LLL:next###” />
###submit_prevStep###¶
a
###submit_prevStep###
b
Use this in multi step forms to add a submit button pointing to the previous step.
Example:
<input type”submit” ###submit_prevStep### value=”###LLL:prev###” />
###submit_reload###¶
a
###submit_reload###
b
Use this for upload fields in your form. By clicking the button, the user can upload a file directly.
Example:
<input type”submit” ###submit_reload### value=”Upload file now” />
###FEUSER_[property]###¶
a
###FEUSER_[property]###
b
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.
###[fieldname]###¶
a
###[fieldname]###
b
GET/POST value of the given inputfield.
###required_[fieldname]###¶
a
###required_[fieldname]###
b
Adds required sign, if this field is marked as required in error checks.
###CAPTCHA###¶
a
###CAPTCHA###
b
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.
###RECAPTCHA###¶
a
###RECAPTCHA###
b
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.
###MATHGUARD###¶
a
###MATHGUARD###
b
This marker gets replaced with a MathGuard security question. The user has to solve the question and enter the result in a form field.
###ERROR###¶
a
###ERROR###
b
Cumulated error messages.
###[fieldname]_minSize###¶
a
###[fieldname]_minSize###
b
Minimum file size for uploaded files in this field. The minimum size is defined in the error check.
###[fieldname]_maxSize###¶
a
###[fieldname]_maxSize###
b
Maximum file size for uploaded files in this field. The maximum size is defined in the error check.
###[fieldname]_allowedTypes###¶
a
###[fieldname]_allowedTypes###
b
Allowed file types for uploaded files in this field. The types are defined in error check.
###[fieldname]_maxCount###¶
a
###[fieldname]_maxCount###
b
Maximum count of files uploaded in this field. The amount is defined in error check.
###[fieldname]_fileCount###¶
a
###[fieldname]_fileCount###
b
Amount of currently uploaded files via this field.
###[fieldname]_remainingCount###¶
a
###[fieldname]_remainingCount###
b
Remaining amount of uploades via this field.
###[fieldname]_uploadedFiles###¶
a
###[fieldname]_uploadedFiles###
b
Names of files uploaded via this field. Use this in combination with the wrap settings for file markers in TypoScript.
###total_uploadedFiles###¶
a
###total_uploadedFiles###
b
Names of files uploaded in this form. Use this in combination with the wrap settings for file markers in TypoScript.
###selected_[fieldname]_[fieldvalue]###¶
a
###selected_[fieldname]_[fieldvalue]###
b
Only for use with dropdowns .
Example:
dropdown: :
<option value="webdesign" ###selected_topic_webdesign###>Webdesign</option>
###checked_[fieldname]_[fieldvalue]###¶
a
###checked_[fieldname]_[fieldvalue]###
b
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
###curStep###¶
a
###curStep###
b
The current step in a multi step form.
###maxStep###¶
a
###maxStep###
b
The last step of a multi step form.
###lastStep###¶
a
###lastStep###
b
The last step the user was in a multi step form.
###step_bar###¶
a
###step_bar###
b
A sample step bar showing the amount of steps and the current step highlighted.
###ADDITIONAL_MULTISTEP###¶
a
###ADDITIONAL_MULTISTEP###
b
Adds the submitted values from other steps as hidden fields to preserve the GET/POST values in order not to lose information of current route in conditional multi step form.
###PRINT_LINK###¶
a
###PRINT_LINK###
b
Only usable in ###TEMPLATE_CONFIRMATION###. Shows a link to print view.
###CSV_LINK###¶
a
###CSV_LINK###
b
Only usable in ###TEMPLATE_CONFIRMATION###. Shows a link to export the submitted values as CSV.
###PDF_LINK###¶
a
###PDF_LINK###
b
Only usable in ###TEMPLATE_CONFIRMATION###. Shows a link to export the submitted values as PDF.
###LINK2SHOW###¶
a
###LINK2SHOW###
b
Only usable in Frontend Listing. Shows a link to detail view.
###DELETE###¶
a
###DELETE###
b
Only usable in Frontend Listing. Shows a link to delete a record.
###BACK_LINK###¶
a
###BACK_LINK###
b
Only usable in Frontend Listing. Shows a link back to list view.
###TIMESTAMP###¶
a
###TIMESTAMP###
b
The current timestamp. Useful in combination with Interceptor_AntiSpamFormTime.
Tutorial¶
How to set up a simple form¶
Create a HTML template file containing your form. Examples can be found in EXT:mailformplusplus/Examples
Create a new page
Create a content element with type “General Plugin”
Choose “MailformPlusPlus” in Dropdown “Plugin”
Check that predefined form "Default" is selected.
Optional: Choose a translation file containing error messages and translations filled into markers ###LLL:[key}###
Optional: Enter settings for E-Mail, required fields or a page to redirect to
Save and view the page
How to set up an advanced form¶
Create a HTML template file containing your form. Examples can be found in EXT:mailformplusplus/Examples
Create a new page
Create an extension template and enter a TypoScript setup entering template file, lang file and other settings.
Create a content element with type “General Plugin”
Choose “MailformPlusPlus” in Dropdown “Plugin”
Save and view the page
NOTE: Configuring your form using TypoScript gives you much more possibilities.
How to use predefined forms¶
Create a TypoScript setup using the predef setting
Example:
plugin.F3_MailformPlusPlus.settings.predef.contactform {
# This name appears in the dropdown selector in plugin record
name = Contact form
...
...
}
Create a content element with type “General Plugin”
Choose “MailformPlusPlus” in Dropdown “Plugin”
Now you can choose the entered predefined form from the “Predefined forms” dropdown.
Save and view the page.
HINT: they are many examples available at EXT:mailformplusplus/Examples
How to set up a multistep form¶
Create a HTML template file containing your form. Examples can be found in EXT:mailformplusplus/Examples/MultiStep
Create a new page
Create an extension template and enter a TypoScript setup entering template file, lang file and other settings.
Create a content element with type “General Plugin”
Choose “MailformPlusPlus” in Dropdown “Plugin”
Choose “Multi step” from Dropdown “Type”
Save and view the page
NOTE: You can overwrite settings made in plugin.F3_MailformPlusPlus.settings for each step using plugin.F3_MailformPlusPlus.settings.[stepnumber]
How to set up a multistep form with conditions¶
Create a HTML template file containing your form. Examples can be found in EXT:mailformplusplus/Examples/MultiStepConditions
Create a new page
Create an extension template and enter a TypoScript setup entering template file, lang file and other settings.
Create a content element with type “General Plugin”
Choose “MailformPlusPlus” in Dropdown “Plugin”
Choose “Multi step” from Dropdown “Type”
Add TypoScript conditions and change the settings plugin.F3_MailformPlusPlus.settings.[stepnumber].templateSuffix
Save and view the page
How to set up spam protection¶
Enable captcha for your form¶
Make sure that the extension "captcha" is installed
Put the input field and the required marker into your template:
###error_captchafield###
###CAPTCHA###
<input type="text" name="mailformplusplus[captchafield]" />
Enter error check for this field in TypoScript
plugin.F3_MailformPlusPlus.settings.validators.1 {
class = F3_MailformPlusPlus_Validator_Default
config {
fieldConf {
captchafield.errorCheck.1 = captcha
}
}
}
Enable sr_freecap for your form¶
Make sure that the extension "sr_freecap" is installed
Put the required subpart into your template. You can change the name of the input field and the HTML code
<!--###CAPTCHA_INSERT### this subpart is removed if CAPTCHA is not enabled! -->
<div>
<label for="freecapfield">###SR_FREECAP_NOTICE###</label>
<div class="clear"></div>
###SR_FREECAP_CANT_READ###
<div class="clear"></div>
<input type="text" size="15" id="freecapfield" name="mailformplusplus[freecapfield]" title="###SR_FREECAP_NOTICE###" value="">
###SR_FREECAP_IMAGE###
</div>
<!--###CAPTCHA_INSERT###-->
Enter error check for this field in TypoScript
plugin.F3_MailformPlusPlus.settings.validators.1 {
class = F3_MailformPlusPlus_Validator_Default
config {
fieldConf {
freecapfield.errorCheck.1 = srFreecap
}
}
}
Enable jm_recaptcha for your form¶
Make sure that the extension "jm_recaptcha" is installed
Register an account at http://recaptcha.net/ to get a public and a private key for your domain.
Enter the keys received from http://recaptcha.net / in TypoScript:
plugin.tx_jmrecaptcha {
public_key = xxx
private_key = xxx
}
Add marker to template:
###error_recaptcha_response_field###
###RECAPTCHA###
Enter error check for this field in TypoScript
plugin.F3_MailformPlusPlus.settings.validators.1 {
class = F3_MailformPlusPlus_Validator_Default
config {
fieldConf {
recaptcha_response_field.errorCheck.1 = jmRecpatcha
}
}
}
Enable mathGuard for your form¶
Add marker to template
###error_mathguard_answer###
###MATHGUARD###
Enter error check for this field in TypoScript
plugin.F3_MailformPlusPlus.settings.validators.1 {
class = F3_MailformPlusPlus_Validator_Default
config {
fieldConf {
mathguard_answer.errorCheck.1 = mathGuard
}
}
}
How to set up error checks¶
Add markers like ###error_[fieldname]### to your template
Set up a validator in TypoScript
plugin.F3_MailformPlusPlus.settings.validators.1 {
class = F3_MailformPlusPlus_Validator_Default
config {
fieldConf {
field1 {
errorCheck.1 = required
errorCheck.2 = maxLength
errorCheck.2.value = 50
}
field2 {
errorCheck.1 = required
errorCheck.2 = email
}
}
}
}
Add entries for error messages to your translation file
<label index="error_field1_required">Field1 is required!</label>
<label index="error_field1_maxLength">Field1 has to be shorter than ###value### characters!</label>
<label index="error_field2_required">Field2 is required!</label>
<label index="error_field2_email">Field2 is no valid e-mail!</label>
NOTE: The marker ###value### in the error message is filled with the value of the parameter “value” for error check “maxLength”. If an error check requires parameters, you can use markers like ###[parametername]### in the translatable message.
Use ###is_error### markers¶
These markers allow you to display additional content is an error occurred for each form field or globally.
In your HTML template you can add these markers:
###is_error###
###is_error_[fieldname]###
MailformPlusPlus will search for content to replace these markers in the translation file and in the TypoScript setup.
In the translation file enter the values like:
<label index="is_error_field1">Error occurred in field1!</label>
A possible TypoScript configuration looks like this:
plugin.F3_MailformPlusPlus.settings {
isErrorMarker {
global = Global message if an error occurred (filled into ###is_error###)
field1 = TEXT
field1.value = Some message (filled into ###is_error_field1###)
}
}
How to fill your own markers via TypoScript¶
Add the marker into your template
###myMarker###
Register the marker in TypoScript. (3 examples available)
plugin.F3_MailformPlusPlus.settings.predef.myForm.markers.myMarker_1 = TEXT
plugin.F3_MailformPlusPlus.settings.predef.myForm.markers.myMarker_1.value = My marker content
# getText function
plugin.F3_MailformPlusPlus.settings.predef.myForm.markers.myMarker_2 = TEXT
plugin.F3_MailformPlusPlus.settings.predef.myForm.markers.myMarker_2.data = getIndpEnv:HTTP_HOST
# Constant insertion
plugin.F3_MailformPlusPlus.settings.predef.myForm.markers.myMarker_3 = TEXT
plugin.F3_MailformPlusPlus.settings.predef.myForm.markers.myMarker_3.value = {$local.myConstant}
The marker will be filled with “My marker content”
NOTE: You can fill your own markers using any TypoScript object like USER or COA. Just try it out.
How to hide unfilled form field values in templates¶
In your HTML-Template you are able to wrap the field output in e-mails and subpart ###TEMPLATE_CONFIRMATION### with a subpart:
<!-- ###ISSET_fax### -->
###value_fax###<br/>
<!-- ###ISSET_fax### -->
If the user filled out the field “fax” in the form, the text will get shown in the e-mails, otherwise it will not be added.
You have the possibility to add some conditions:
<!-- ###ISSET_fax&&phone### -->
###value_fax###<br/>
<!-- ###ISSET_fax&&phone### -->
<!-- ###ISSET_fax&&!phone### -->
###fax###<br/>
<!-- ###ISSET_fax&&!phone### -->
<!-- ###ISSET_fax||phone### -->
###fax###<br/>
<!-- ###ISSET_fax||phone### -->
As you see, you can use the operators (&&,||,!) to do some simple checks.
NOTE: The case of the fieldname in ISSET subpart and marker MUST match.
good:
<!-- ###ISSET_EMAIL### -->
###value_EMAIL###
<!-- ###ISSET_EMAIL### -->
<!-- ###ISSET_email### -->
###value _email###
<!-- ###ISSET_email### -->
bad:
<!-- ###ISSET_EMAIL### -->
###value _email###
<!-- ###ISSET_EMAIL### -->
<!-- ###ISSET_email### -->
###value _EMAIL###
<!-- ###ISSET_email### -->
How to set up multi language forms¶
In the template file:
Specify markers for the multi language texts.
example:
<!-- ###TEMPLATE_FORM### begin -->
<form name="form" method="post" action="###REL_URL###">
<input type="hidden" name="submitted" value="1">
<table>
<tr>
<td>###LLL:username###</td>
<td><input type="text" name="username" value="###value_username###"></td>
</tr>
<tr>
<td>###LLL:password###</td>
<td><input type="password" name="password" value="###value_password###"></td>
</tr>
<tr>
<td colspan=”2”><input type="submit" name="submit" value="###LLL:submit###"></td>
</tr>
</table>
</form>
<!-- ###TEMPLATE_FORM### end -->
Your custom language file:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
<meta type="array">
<description>Language labels for my form</description>
</meta>
<data type="array">
<languageKey index="default" type="array">
<label index="username">Username:</label>
<label index="password">Password:</label>
<label index="submit">Login</label>
</languageKey>
<languageKey index="de" type="array">
<label index="username">Benutzername:</label>
<label index="password">Passwort:</label>
<label index="submit">Anmelden</label>
</languageKey>
</data>
</T3locallang>
TypoScript:
You can specifiy the path to your translation file in any setting “langFile” associated with “mailformplusplus”.
Example:
plugin.F3_MailformPlusPlus.settings.langFile = fileadmin/lang/myLangFile.xml
How to load data from DB to use in Finisher_DB¶
It may be useful to extend the set of data submitted in the form before inserting them in the database. You may want to fetch additional data from the database, the session, the GET / POST parameters or from something else. This can be done quite easily since the key "mapping" can understand TypoScript.
Let's have a look at the following lines. They are 4 examples, field_demo_1, field_demo_2, field_demo_3, field_demo_4.
2.class = F3_MailformPlusPlus_Finisher_DB
2.config {
table = tt_content
key = uid
fields {
# Retrieves data from the GET / POST parameters
field_demo_1 {
mapping = TEXT
mapping.data = GPvar:mailformplusplus|firstname
}
# Retrieves data from the database
field_demo_2 {
mapping = TEXT
mapping {
dataWrap = DB:tx_cuso_courses:{GPvar:mailformplusplus|course_uid}:title
insertData = 1
wrap3 = {|}
}
}
# Retrieves data from the session
field_demo_3 {
mapping = TEXT
mapping.data = TSFE:fe_user|user|last_name
}
# Some more cool stuff
field_demo_4 {
mapping = COA
mapping {
10 = TEXT
10 {
data = GPvar:mailformplusplus|firstname
}
20 = TEXT
20 {
data = GPvar:mailformplusplus|lastname
noTrimWrap = | |: |
}
30 = TEXT
30 {
dataWrap = DB:tx_cuso_courses:{GPvar:mailformplusplus|course_uid}:title
insertData = 1
wrap3 = {|}
}
}
}
}
}
How to use HTML as PDF template¶
This only works if Generator_TCPDF is used.
<!-- ###TEMPLATE_PDF### -->
<table>
<!-- ###pid###, ###submission_date### and ###ip### are predefined markers to use in this subpart -->
<tr>
<td>###LLL:pid###</td>
<td>###pid###</td>
</tr>
<tr>
<td>###LLL:ip###</td>
<td>###ip###</td>
</tr>
<tr>
<td>###LLL:submission_date###</td>
<td>###submission_date###</td>
</tr>
<tr>
<td>###LLL:[fieldname]###</td>
<td>###value_[fieldname]###</td>
</tr>
</table>
<!-- ###TEMPLATE_PDF### -->
How to upgrade from th_mailformplus to Mailformplus MVC¶
There are many forms out there which use th_mailformplus. If you ask yourself, what would happen if you did an update to Mailformplus MVC, here is a short explanation on how to change the TypoScript of th_mailformplus to work with MailformplusMVC. This is not a complete tutorial, it only shows the basic differences. Many of the TypoScript settings are named equally, but some also have changed, were removed or didn't exist in th_mailformplus.
A TypoScript setup for th_mailformplus may look like this:
plugin.tx_thmailformplus_pi1 {
langFile = typo3conf/ext/th_mailformplus/example_form/singlepage_forms/improved_demo_lang.php
default {
email_to = admin@host.com
email_sendtouser = email
email_subject_user = Your contact request
email_sender = noreply@host.com
}
fieldConf {
name {
errorCheck = required
}
email {
errorCheck = required,email
}
text {
errorCheck = required
}
}
}
In this configuration a translation file is included, error checks are defined and settings for email sending to an admin and the user are made.
The same configuration with Mailformplus MVC will look this way:
plugin.F3_MailformPlusPlus.settings {
langFile = typo3conf/ext/th_mailformplus/example_form/singlepage_forms/improved_demo_lang.php
validators.1.class = Validator_Default
validators.1.config {
name {
errorCheck.1 = required
}
email {
errorCheck.1 = required
errorCheck.2 = email
}
text {
errorCheck = required
}
}
finishers.1.class = FinisherMail
finishers.1.config {
admin {
to_email = admin@host.com
sender_email = noreply@host.com
}
user {
to_email = email
sender_email = noreply@host.com
subject = Your contact request
}
}
}
As you see, the configuration looks similar, but Mailformplus MVC uses blocks like “validators” or “finishers” to make it possible to group any number of classes. So that it is possible to let “finishers.1” be a class to send emails and “finishers.2” be a class to store data into database.
When you compare the TypoScript options of th_mailformplus with Mailformplus MVC you will find out that they are quite similar and you should have no problems with writing configuration for Mailformplus MVC if you knew th_mailformplus before.
Known problems¶
- When using AJAX remove links for uploaded files the file markers such as ###[fieldname]_fileCount### do not get updated because the request only refreshes the content of the marker ###[fieldname]_uploadedFiles###. A possible solution would be to reload the whole form using the AJAX request.
- Some problems may occur in multistep handling, when using the submit_reload feature. We are aware of this problem and will solve it in the future.
To-Do list¶
- Add a 1-2-3 wizard to generate form templates, translation files and TypoScript setup code.
- Think about integration of “extBase” architecture and usage of Fluid.