Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.
| Beide Seiten, vorherige ÜberarbeitungVorherige ÜberarbeitungNächste Überarbeitung | Vorherige Überarbeitung | ||
| typo3:form [2017/07/06 18:39] – [Default-Werte überschreiben] admin | typo3:form [2023/04/26 20:02] (aktuell) – [Finisher: SaveToDatabase und Datei-Upload] admin | ||
|---|---|---|---|
| Zeile 97: | 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 205: | 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=" | ||
| + | < | ||
| + | </ | ||
| + | |||
| </ | </ | ||