TYPO3 - cms-forms - Remove Input from Email

Viewed 61

I am trying to remove an input field from the generated email. With Powermail it is relatively easy. There I can exclude fields in the typoscript. How could something like this look with cms-forms?

Example powermail

      excludeFromPowermailAllMarker {
        # On Confirmation Page (if activated)
        confirmationPage {
          # add some markernames (commaseparated) which should be excluded
          excludeFromMarkerNames = datenschutzbestimmungen, agb
        }
      }

TYPO3 11.5.12 php 8.1.2

1 Answers

This is possible with the form variants introduced in TYPO3 version 9.

Hide a form element in certain finishers and on the summary step:

type: Form
identifier: test
prototypeName: standard
label: Test
finishers:
  -
    identifier: EmailToReceiver
    options:
      subject: Testmail
      recipientAddress: tritum@example.org
      recipientName: 'Test'
      senderAddress: tritum@example.org
      senderName: tritum@example.org
renderables:
  -
    type: Page
    identifier: page-1
    label: 'Page 1'
    renderables:
      -
        type: Text
        identifier: text-1
        label: 'Text 1'
        variants:
          -
            identifier: hide-1
            renderingOptions:
              enabled: false
            condition: 'stepType == "SummaryPage" || finisherIdentifier in ["EmailToSender", "EmailToReceiver"]'
      -
        type: Text
        identifier: text-2
        label: 'Text 2'
  -
    type: SummaryPage
    identifier: summarypage-1
    label: 'Summary step'

The relevant part (which disables rendering of the field in the summary page, the email to sender finisher or the email to sender finisher) is

variants:
  -
    identifier: hide-1
    renderingOptions:
      enabled: false
    condition: 'stepType == "SummaryPage" || finisherIdentifier in ["EmailToSender", "EmailToReceiver"]'
Related