Please note that this documentation is for the most recent version of this extension. It may not be relevant for older versions. Related documentation can be found in the documentation directory of the extension.
Form Definition
Forms are defined in the frontend via TypoScript. A distinction is made between forms for creating (Create) and editing (Edit) records. The basic configuration takes place under plugin.tx_modules.settings.forms.
Basic Configuration
Each form is configured via a unique identifier (e.g. addressCreate or address).
plugin.tx_modules.settings.forms.myFormIdentifier {
# Database table to which the form refers
table = tx_extension_domain_model_example
# Storage location for new records (only relevant for creation)
storagePid = 123
# Default values for new records (only relevant for creation)
defaults {
hidden = 0
deleted = 0
# Type of the model, if necessary (full class name)
# type = CodingMs\Extension\Domain\Model\Example
}
# Notification on saving
mailOnSave {
active = 1
subject = Neuer Datensatz erstellt
fromEmail = sender(at)example(dot)com
toEmail = receiver(at)example(dot)com
}
# Messages for the user
messages {
error {
title = Fehler
savingFailed = Bitte überprüfen Sie Ihre Eingaben.
}
success {
title = Erfolg
successfullySaved = Ihre Daten wurden erfolgreich gespeichert.
}
}
# Definition of form fields
fieldsets {
# ...
}
}
Fieldsets and Fields
The form is divided into fieldsets. Usually there is a general fieldset for the input fields and a buttons fieldset for the actions.
Fields are mostly copied from predefined presets provided in plugin.tx_modules.presets.fields.
fieldsets {
general < plugin.tx_modules.presets.fieldsets.normal
general {
label = Allgemein
fields {
# Example for a text field
company < plugin.tx_modules.presets.fields.input
company {
label = Firma
placeholder = Musterfirma GmbH
required = 0
validation {
NotEmpty = Bitte geben Sie eine Firma ein
}
}
}
}
# Buttons at the end of the form
buttons < plugin.tx_modules.presets.fieldsets.buttons
buttons {
fields {
submit < plugin.tx_modules.presets.fields.submit
submit {
label = Speichern
css.class.wrapper = form-group form-input-submit float-start me-1
}
cancelAndBackToListButton < plugin.tx_modules.presets.fields.cancelAndBackToListButton
cancelAndBackToListButton {
label = Abbrechen
css.class.wrapper = form-group form-input-submit float-start me-1
}
}
}
}
Available Field Types (Presets)
The following presets are available under plugin.tx_modules.presets.fields:
input- Simple text fieldtextarea- Multiline text fieldrte- Rich Text Editorcheckbox- Checkbox (e.g. for terms and conditions or boolean values)checkboxes- Multiple selection via checkboxes (relations)select- Selection box (Dropdown)selectCountry- Country selectionfiles- File upload (requires corresponding configuration for relations)inputDate- Date fieldinputDateTime- Date and time fieldinputEmail- E-mail field with validationinputSlug- URL segment fieldhidden- Hidden field
Validation
Validators can be defined per field in the validation block. The key is the name of the validator, the value is the error message displayed if validation fails.
More on this under Available Validators.
validation {
NotEmpty = Dieses Feld ist ein Pflichtfeld
Email = Bitte geben Sie eine gültige E-Mail Adresse ein
}
Multilanguage Support
Labels and error messages can be overridden depending on the language via TypoScript conditions:
[siteLanguage("locale") == "de-DE"]
plugin.tx_modules.settings.forms.myFormIdentifier {
messages {
success.successfullySaved = Datensatz gespeichert
}
fieldsets {
general {
label = Allgemein
fields {
company {
label = Firma
validation {
NotEmpty = Bitte geben Sie eine Firma ein
}
}
}
}
}
}
[GLOBAL]
