Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.
| Beide Seiten, vorherige ÜberarbeitungVorherige ÜberarbeitungNächste Überarbeitung | Vorherige Überarbeitung | ||
| typo3:form [2017/07/04 19:58] – Finisher: SaveToDatabase admin | typo3:form [2023/04/26 20:02] (aktuell) – [Finisher: SaveToDatabase und Datei-Upload] admin | ||
|---|---|---|---|
| Zeile 21: | Zeile 21: | ||
| ===== Konfigurationen ===== | ===== Konfigurationen ===== | ||
| + | |||
| + | ==== Finisher Confirmation: | ||
| + | |||
| + | Mit der folgenden Konfiguration lässt sich die Nachricht, die nach Absenden des Formulars angezeigt wird, vom Redakteur über das Plugin individuell anpassen. | ||
| + | |||
| + | <code yaml> | ||
| + | TYPO3: | ||
| + | CMS: | ||
| + | Form: | ||
| + | prototypes: | ||
| + | standard: | ||
| + | finishersDefinition: | ||
| + | Confirmation: | ||
| + | FormEngine: | ||
| + | label: ' | ||
| + | elements: | ||
| + | message: | ||
| + | label: ' | ||
| + | config: | ||
| + | type: ' | ||
| + | </ | ||
| ---- | ---- | ||
| Zeile 76: | Zeile 97: | ||
| mapOnDatabaseColumn: | mapOnDatabaseColumn: | ||
| </ | </ | ||
| + | |||
| + | ==== Finisher: SaveToDatabase und Datei-Upload ==== | ||
| + | |||
| + | Wenn das Formular ein Feld des Typs // | ||
| + | |||
| + | Mit dem '' | ||
| + | * In einer eigenen Tabelle für Formular-Einträge wird die UID des // | ||
| + | * In der Tabelle // | ||
| + | |||
| + | Im TYPO3-Backend ist die hochgeladene Datei damit korrekt dem Datensatz in der eigenen Datenbanktabelle zugeordnet. | ||
| + | |||
| + | <code yaml> | ||
| + | type: Form | ||
| + | identifier: UploadForm | ||
| + | label: ' | ||
| + | prototypeName: | ||
| + | finishers: | ||
| + | - | ||
| + | identifier: SaveToDatabase | ||
| + | options: | ||
| + | - | ||
| + | table: ' | ||
| + | mode: insert | ||
| + | databaseColumnMappings: | ||
| + | pid: | ||
| + | value: 6 | ||
| + | crdate: | ||
| + | value: ' | ||
| + | tstamp: | ||
| + | value: ' | ||
| + | formtitle: | ||
| + | value: ' | ||
| + | elements: | ||
| + | fileupload: | ||
| + | mapOnDatabaseColumn: | ||
| + | - | ||
| + | table: sys_file_reference | ||
| + | mode: insert | ||
| + | elements: | ||
| + | fileupload: | ||
| + | mapOnDatabaseColumn: | ||
| + | databaseColumnMappings: | ||
| + | # Achtung: ab TYPO3 v12 müssen die beiden nachfolgenden Zeilen entfernt werden! | ||
| + | table_local: | ||
| + | value: ' | ||
| + | tablenames: | ||
| + | value: ' | ||
| + | fieldname: | ||
| + | value: ' | ||
| + | tstamp: | ||
| + | value: ' | ||
| + | crdate: | ||
| + | value: ' | ||
| + | uid_foreign: | ||
| + | value: ' | ||
| + | renderables: | ||
| + | - | ||
| + | type: Page | ||
| + | identifier: page-1 | ||
| + | label: Page | ||
| + | renderables: | ||
| + | - | ||
| + | properties: | ||
| + | saveToFileMount: | ||
| + | allowedMimeTypes: | ||
| + | - application/ | ||
| + | fluidAdditionalAttributes: | ||
| + | required: required | ||
| + | type: FileUpload | ||
| + | identifier: fileupload | ||
| + | label: 'Datei hochladen' | ||
| + | validators: | ||
| + | - | ||
| + | identifier: NotEmpty | ||
| + | </ | ||
| + | |||
| + | Der Ruhm hierfür gilt **Olaf Schmidt-Wischhöfer**; | ||
| ---- | ---- | ||
| Zeile 87: | Zeile 185: | ||
| Ein möglicher Anwendungsfall ist, den Titel der aktuellen Seite im Formular mit zu übergeben. Oder einen GET-Parameter auszulesen und damit ein Feld vorauszufüllen. Mit TypoScript, '' | Ein möglicher Anwendungsfall ist, den Titel der aktuellen Seite im Formular mit zu übergeben. Oder einen GET-Parameter auszulesen und damit ein Feld vorauszufüllen. Mit TypoScript, '' | ||
| - | Die Anzahl und Verschachtelung der '' | + | Die Anzahl und Verschachtelung der '' |
| + | <WRAP center round tip 100%> | ||
| + | Die korrekte Verschachtelung entnimmt man am besten direkt der Konfiguration. Im folgenden Beispiel habe ich versucht, dies zu verdeutlichen. Die Indexnummern der '' | ||
| + | |||
| + | Mit ''< | ||
| + | </ | ||
| + | |||
| + | |||
| + | **ContactForm.yaml** | ||
| + | <code yaml> | ||
| + | |||
| + | identifier: contactForm | ||
| + | label: ContactForm | ||
| + | type: Form | ||
| + | prototypeName: | ||
| + | renderables: | ||
| + | - | ||
| + | identifier: page-1 | ||
| + | label: ' | ||
| + | type: Page | ||
| + | renderables: | ||
| + | - | ||
| + | defaultValue: | ||
| + | identifier: name | ||
| + | label: Name | ||
| + | type: Text | ||
| + | properties: | ||
| + | fluidAdditionalAttributes: | ||
| + | placeholder: | ||
| + | validators: | ||
| + | - | ||
| + | identifier: NotEmpty | ||
| + | - | ||
| + | defaultValue: | ||
| + | identifier: subject | ||
| + | label: Subject | ||
| + | type: Text | ||
| + | properties: | ||
| + | fluidAdditionalAttributes: | ||
| + | placeholder: | ||
| + | validators: | ||
| + | - | ||
| + | identifier: NotEmpty | ||
| + | - | ||
| + | defaultValue: | ||
| + | identifier: email | ||
| + | label: Email | ||
| + | type: Text | ||
| + | properties: | ||
| + | fluidAdditionalAttributes: | ||
| + | placeholder: | ||
| + | validators: | ||
| + | - | ||
| + | identifier: NotEmpty | ||
| + | - | ||
| + | identifier: EmailAddress | ||
| + | - | ||
| + | defaultValue: | ||
| + | type: Hidden | ||
| + | identifier: pagetitle | ||
| + | label: Page title | ||
| + | - | ||
| + | defaultValue: | ||
| + | identifier: message | ||
| + | label: Message | ||
| + | type: Textarea | ||
| + | properties: | ||
| + | fluidAdditionalAttributes: | ||
| + | placeholder: | ||
| + | validators: | ||
| + | - | ||
| + | identifier: NotEmpty | ||
| + | </ | ||
| + | |||
| + | **TypoScript: | ||
| <code typoscript> | <code typoscript> | ||
| plugin.tx_form.settings { | plugin.tx_form.settings { | ||
| formDefinitionOverrides { | formDefinitionOverrides { | ||
| - | // bitte den richtigen Identifier eintragen: | + | // bitte den richtigen |
| - | | + | |
| + | // auf root-Ebene der Formular-Definition: | ||
| renderables { | renderables { | ||
| + | // Erstes Element - identifier: page-1 | ||
| 0 { | 0 { | ||
| renderables { | renderables { | ||
| - | // Indexnummer | + | // Viertes Element unterhalb von page-1 - identifier: pagetitle |
| - | | + | |
| defaultValue = TEXT | defaultValue = TEXT | ||
| defaultValue.data = page:title | defaultValue.data = page:title | ||
| - | } | ||
| - | | ||
| - | 2 { | ||
| - | label = TEXT | ||
| - | label.value = Alternatives Label für Feld | ||
| } | } | ||
| } | } | ||
| Zeile 113: | Zeile 282: | ||
| } | } | ||
| } | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Templating ===== | ||
| + | |||
| + | ==== Formular in Fluid-Template rendern ==== | ||
| + | |||
| + | Aufgrund eines Bugs können Formulare nur mit einem Workaround in Website-Templates integriert werden. | ||
| + | |||
| + | - Issue: https:// | ||
| + | |||
| + | **TypoScript: | ||
| + | <code typoscript> | ||
| + | lib.embeddedForm = FLUIDTEMPLATE | ||
| + | lib.embeddedForm { | ||
| + | template = TEXT | ||
| + | template { | ||
| + | value = < | ||
| + | } | ||
| + | extbase { | ||
| + | pluginName = Formframework | ||
| + | controllerExtensionName = Form | ||
| + | controllerName = FormFrontend | ||
| + | controllerActionName = perform | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | **Fluid:** | ||
| + | <code html> | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | Danke an Daniel Siepmann, der die Lösung am 6. Oktober 2020 in Slack gepostet hat! | ||
| + | |||
| + | ---- | ||
| + | ==== templateRootPaths für Formulare einrichten ==== | ||
| + | |||
| + | <code yaml> | ||
| + | TYPO3: | ||
| + | CMS: | ||
| + | Form: | ||
| + | prototypes: | ||
| + | myCustomForm: | ||
| + | __inheritances: | ||
| + | 10: ' | ||
| + | formElementsDefinition: | ||
| + | Form: | ||
| + | renderingOptions: | ||
| + | templateRootPaths: | ||
| + | 100: ' | ||
| + | partialRootPaths: | ||
| + | 100: ' | ||
| + | layoutRootPaths: | ||
| + | 100: ' | ||
| + | </ | ||
| + | |||
| + | ==== Eigene Templates für E-Mails ==== | ||
| + | |||
| + | Aktuell ist das Form Framework so eingerichtet, | ||
| + | |||
| + | Bis dies behoben ist, können alternative Templates direkt im Finisher des Formulars verknüpft werden. | ||
| + | |||
| + | **ContactForm.yaml** | ||
| + | <code yaml> | ||
| + | finishers: | ||
| + | - | ||
| + | identifier: EmailToSender | ||
| + | options: | ||
| + | subject: ' | ||
| + | recipientAddress: | ||
| + | recipientName: | ||
| + | senderAddress: | ||
| + | senderName: '' | ||
| + | replyToAddress: | ||
| + | carbonCopyAddress: | ||
| + | blindCarbonCopyAddress: | ||
| + | format: html | ||
| + | attachUploads: | ||
| + | templatePathAndFilename: | ||
| + | </ | ||
| + | |||
| + | Forge: [[https:// | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Personalisierte Anrede in E-Mails ===== | ||
| + | |||
| + | **Form Definition**: | ||
| + | <code yaml> | ||
| + | renderables: | ||
| + | - | ||
| + | identifier: page-1 | ||
| + | label: ' | ||
| + | type: Page | ||
| + | renderables: | ||
| + | - | ||
| + | properties: | ||
| + | options: | ||
| + | Herr: Herr | ||
| + | Frau: Frau | ||
| + | prependOptionLabel: | ||
| + | fluidAdditionalAttributes: | ||
| + | required: required | ||
| + | type: SingleSelect | ||
| + | identifier: title | ||
| + | label: Title | ||
| + | validators: | ||
| + | - | ||
| + | identifier: NotEmpty | ||
| + | - | ||
| + | defaultValue: | ||
| + | type: Text | ||
| + | identifier: lastname | ||
| + | label: ' | ||
| + | properties: | ||
| + | fluidAdditionalAttributes: | ||
| + | required: required | ||
| + | placeholder: | ||
| + | validators: | ||
| + | - | ||
| + | identifier: NotEmpty | ||
| + | |||
| + | </ | ||
| + | |||
| + | **/ | ||
| + | <code html> | ||
| + | < | ||
| + | <f:case value=" | ||
| + | <f:case value=" | ||
| + | < | ||
| + | </ | ||
| + | |||
| </ | </ | ||