Formhandler settings in typo3


More info

Any component and complete component arrays can be disabled via TypoScript.

Version added

1.0.0

TypoScript path

plugin.Tx_Formhandler.settings copy to clipboard

Example code

plugin.Tx_Formhandler.settings {

validators {
1 {
class = Validator_Default
disable = 1
config.fieldConf {
company.errorCheck.1 = required
name.errorCheck.1 = required
}
}
}

finishers {

disable = 1

1.class = Finisher_Mail

1.config {

admin {

to_email = email@example.tld

subject = TEXT

subject.data = LLL:fileadmin/templates/ext/formhandler/lang.xml:email_admin_subject

sender_email = email@example.tld

attachment = picture

}

user {

to_email = email

subject = TEXT

subject.data = LLL:fileadmin/templates/ext/formhandler/lang.xml:email_user_subject

sender_email = email@example.tld

}

}

2.class = Finisher_SubmittedOK

2.config {

returns = 1

}

}

}

Properties

.templateFile

Path to template file or template code

Data type

String / cObj

Version added

1.0.0

.masterTemplateFile

Path to master template file.

A master template can be used to predefine HTML code for various form fields or email templates. These predefined snippets can be used in the template file by just adding a marker there.

Data type

String / cObj / Array

Version added

1.0.0

Example code

#single master template

masterTemplateFile = fileadmin/templates/formmaster.html

#use a cObject

masterTemplateFile = TEXT

masterTemplateFile {

value = fileadmin/mymastertemplate.html

}

#multiple master templates

masterTemplateFile {

1 = fileadmin/templates/formmaster.html

2 = fileadmin/templates/master_for_contactform.html

}

#use cObjects for multiple master templates

masterTemplateFile {

1 = TEXT

1.value = fileadmin/templates/formmaster.html

2 = fileadmin/templates/master_for_contactform.html

}

.langFile

Path to language files

Data type

String | cObj | Array

Version added

1.0.0

Example code

#single lang file

langFile = fileadmin/lang/shared.xml

#use a cObject

langFile = TEXT

langFile.value = fileadmin/lang/shared.xml

#multiple lang files

langFile {

1 = fileadmin/lang/shared.xml

2 = fileadmin/lang/forms/mailformxy.xml

}

#use cObjects for multiple lang files

langFile {

1 = TEXT

1.value = fileadmin/lang/shared.xml

2 = fileadmin/lang/forms/mailformxy.xml

}

.additionalIncludePaths

The component manager will search for classes in paths entered here.

NOTE: additionalIncludePaths on global level and additionalIncludePaths on predef level will be merged. So you can define include paths for all your forms and special ones for single forms.

Use this if you create your own components and do not want to create an extension for that. (See section How to use your own components for details).

Data type

Array

Version added

1.0.0

Example code

plugin.Tx_Formhandler.settings {

additionalIncludePaths {

1 = fileadmin/templates/scripts

}

}

# If you use “predef” for your form, you can also use it for “additionalIncludePaths”:

plugin.Tx_Formhandler.settings.predef.example {

additionalIncludePaths {

1 = fileadmin/templates/scripts

}

}

.cssFile

Path to stylesheet file(s).

Data type

String | Array

Example code

cssFile = fileadmin/css/forms.css

cssFile {

1 = fileadmin/css/forms.css

2 = fileadmin/css/contactform.css

}

.jsFile

Path to JavaScript file(s).

Data type

String | Array

Version added

1.0.0

Example code

jsFile = fileadmin/js/jquery.js

jsFile {

1 = fileadmin/js/jquery.js

2 = fileadmin/js/jquery_plugin.js

}

.view

Class name of the view to be used

Data type

String | cObj

Default value

Tx_Formhandler_View_Default

Version added

1.0.0

.controller

Class name of the controller to be used

Data type

String | cObj

Default value

Tx_Formhandler_Controller_Default

Version added

1.0.0

.formID

Value of the id attribute of the form tag. This is mandatory, if you use enableFileRemoval and have more than one form on a page.

Without formID the JavaScript code to remove a file from the uploaded files list submits the first form on the page.

Data type

String | cObj

Version added

1.0.0

.uniqueFormID

Specify your own unique form ID. If nothing is configured, Formhandler will generate a random hash for each form.

The unique form ID is used to store session values for each form so that they do not conflict with each other.

The drawback of a random hash is that you cannot access the session values in TypoScript without a custom userFunc.

Data type

String | cObj

Default value

Unique hash generated by Formhandler

Version added

1.0.0

.formValuesPrefix

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!

Data type

String | cObj

Version added

1.0.0

Example code

<input type=”text” name=”formhandler[email]” value=”###value_email###” />

<!– Or use a marker in your HTML –>

<input type=”text” name=”###formValuesPrefix###[email]” value=”###value_email###” />

.debug

Toggle debug mode, which will print debug messages to screen

Data type

Boolean | cObj

Version added

1.0.0

.disableConfigValidation

Formhandler will check if all needed classes are used in TypoScript for the values entered in Flexform. If you have your own components using the Flexform values, you can disable this check using disableConfigValidation = 1

Data type

Boolean | cObj

Version added

1.0.0

.disableWrapInBaseClass

Set this option to “1” to disable the default wrap with a DIV with class “Tx-Formhandler”.

Data type

Boolean | cObj

Version added

1.1.0

.ajax

Configure an AjaxHandler that handles AJAX validation and AJAX based removal of uploaded files.

Data type

Array

Version added

1.0.0

Example code

plugin.Tx_Formhandler.settings {

ajax {

class = AjaxHandler_JQuery

config {

}

}

}

.requiredSign

Enter some text which will be used to substitute markers like ###required_[fieldname]###.

Data type

String | cObj

Default value

*

Version added

1.0.0

.singleErrorTemplate.totalWrap

Enter something to be wrapped around the error messages of a single form field.

Data type

Wrap

Version added

1.0.0

.singleErrorTemplate.singleWrap

Enter something to be wrapped around each error message of a single form field.

Data type

Wrap

Version added

1.0.0

.singleErrorTemplate.addDefaultMessage

Adds the error message found in ‘error_[fieldname]’ in the language file at any time.

Data type

Boolean | cObj

Version added

1.0.0

.errorListTemplate.totalWrap

Enter something to be wrapped around the error message list of all form fields.

Data type

Wrap

Version added

1.0.0

.errorListTemplate.singleWrap

Enter something to be wrapped around the error messages of a single form field in the list of all form fields.

Data type

Wrap

Version added

1.0.0

.singleFileMarkerTemplate.totalWrap

Enter something to be wrapped around the full list of filenames in a file marker for a single form field.

Data type

Wrap

Version added

1.0.0

.singleFileMarkerTemplate.singleWrap

Enter something to be wrapped around each filename in a file marker for a single form field.

Data type

Wrap

Version added

1.0.0

.singleFileMarkerTemplate.showThumbnails

Shows thumbnail of uploaded file instead of filename. Set to 2 to display thumbnail and filename.

Data type

Integer (0,1,2)

Version added

1.0.0

.singleFileMarkerTemplate.image

IMAGE object for thumbnail generation. Image.file gets inserted by Formhandler

Data type

IMAGE

Version added

1.0.0

.totalFilesMarkerTemplate.totalWrap

Enter something to be wrapped around the full list of filenames in a file marker for all form fields.

Data type

Wrap

Version added

1.0.0

.totalFilesMarkerTemplate.singleWrap

Enter something to be wrapped around each filename in a file marker for all form fields.

Data type

Wrap

Version added

1.0.0

.totalFilesMarkerTemplate.showThumbnails

Shows thumbnail of uploaded file instead of filename. Set to 2 to display thumbnail and filename.

Data type

Integer (0,1,2)

Version added

1.0.0

.files.uploadFolder

Path to a custom upload folder

Data type

String | cObj

Default value

uploads/formhandler/tmp

Version added

1.0.0

.files.enableAjaxFileRemoval

You need to use an AjaxHandler for this feature.

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.

Data type

Boolean | cObj

Version added

1.0.0

.files.enableFileRemoval

Enables file removal without using an AjaxHandler. It will just display an “X” or anything entered in files.customRemovalText next to a file name of an uploaded file, so the user can remove it.

Without formID the JavaScript code to remove a file from the uploaded files list submits the first form on the page.

Data type

Boolean | cObj

Version added

1.0.0

.files.customRemovalText

Enter a custom text shown as the text of the remove link. Used in combination with files.enableAjaxFileRemoval and files.enableFileRemoval.

Data type

String | cObj

Default value

X

Version added

1.0.0

.files.search

Comma separated list of characters to replace in file names of uploaded files.

Useful in combination with files.replace.

Data type

String | cObj

Default value

Space character and %20

Version added

1.0.0

Example code

plugin.Tx_Formhandler.settings {

files {

search = ä,ö,ü

replace = ae,oe,ue

}

}

.files.replace

Comma separated list of characters to use as a replacement for the characters configured in files.search.

Data type

String | cObj

Default value

Version added

1.0.0

Example code

plugin.Tx_Formhandler.settings {

files {

search = ä,ö,ü

replace = ae,oe,ue

}

}

.markers.[markername]

Define your own custom markers and fill them using TypoScript.

Data type

Array

Version added

1.0.0

Example code

plugin.Tx_Formhandler.settings {

markers {

myCustomMarker = TEXT

myCustomMarker.value = Hello world

}

}

Define a marker in Typoscript. You can use ###myCustomMarker### in your HTML template to show the content of this marker.

.checkBoxFields

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.

Data type

String | cObj

Version added

1.0.0

Example code

plugin.Tx_Formhandler.settings {

# Checkbox fields in step 1

1.checkBoxFields = interests, hobbies

# Checkbox fields in step 2

2.checkBoxFields = work_experience,accounts

}

.templateSuffix

With a templateSuffix you can define different template subparts for the same form step or email.

It can be used in combination with the setting if to define different routes through the form depending on the user input.

Have a look at “How to set up a multi step form with conditions” for details.

Data type

String | cObj

Version added

1.0.0

.checkBoxUncheckedValue

Lets you define values for unchecked checkboxes listed in checkBoxFields.

Data type

String | Array

Version added

1.0.0

Example code

plugin.Tx_Formhandler.settings {

# Default value for ALL checkboxes

checkBoxUncheckedValue = no

# Default value for a specific checkbox

checkBoxUncheckedValue.myCheckBox = yes

}

.addErrorAnchors

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]###.

Data type

Boolean | cObj

Version added

1.0.0

.predef

Predefine form settings and make them selectable in plugin record.

Have a look at the section “How to use predefined forms”

Data type

Array

Version added

1.0.0

.isErrorMarker

Configure replacements for ###is_error_[fieldname]### markers.

Data type

Array

Version added

1.0.0

Example code

plugin.Tx_Formhandler.settings {

isErrorMarker {

global = Global message if an error occurred (filled into ###is_error###)

default = class=”error” (filled into ###is_error_[fieldname]###

field1 = TEXT

field1.value = Some message (filled into ###is_error_field1###)

}

}

.fillValueMarkersBeforeLangMarkers

If set to 1, the value markers (###value_[field]###) are replaced before the language markers (###LLL:[field]###).

Data type

Boolean | cObj

Version added

1.0.0

.arrayValueSeparator

Say you are using a checkbox array named “cb”, then the marker ###value_cb### will contain a comma separated list of the selected values. Use this option to specifiy your own separator.

Data type

String | cObj

Version added

1.0.0

Example code

plugin.Tx_Formhandler.settings {

arrayValueSeparator = |

}

.if

Define several conditions to change the behaviour of the form depending on user input.

These conditions can be used to show different form output or do different validation depending on what the user entered or selected before.

Have a look at “How to set up a multistep form with conditions” for details.

Data type

Array

Version added

1.0.0

.skipView

Skip all HTML output and call only the components in this order:

PreProcessors

InitInterceptors

Validators

SaveInterceptors

Finishers

Use this if you want to use Formhandler for data processing only, e.g. to validate a generated auth code.

Data type

Integer – cObj

Version added

1.0.0

.useDefaultStepBarStyles

If you use the marker ###step_bar### to insert an automatically created step bar, you can choose to use some default styles or choose to add your own styling.

Data type

Boolean | cObj

Version added

1.0.0

.stepbar_color

If you use the marker ###step_bar### to insert an automatically created step bar, you can specify the color of it.

Data type

String | cObj

Default value

#EAEAEA

Version added

1.0.0

If you have any query then feel free to contact me at Jainish Senjaliya

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s