I'm using the latest TYPO3 9.5.13 and made an contact form with the new form system extension: form
I need a checkbox before Submit button, f.e. "I've read the privacy policy .. "
I've found this extension, because this is not working out of the box.
https://github.com/tritum/form_element_linked_checkbox (installed via composer the latest master 1.1.0)
I can't create a Text like this: "Yes, I've read the privacy policy and blahablah .." The link is always at the end of the label. I've made it like they shown in the description of the extension form-element-linked-checkbox. Have I forget something? Here's my YAML
-
type: LinkedCheckbox
identifier: linkedcheckbox-1
label: ' Ja, ich habe die %s gelesen und bin mit der Verarbeitung meiner Daten einverstanden.'
properties:
pageUid: '17'
linkText: Datenschutzhinweise
elementDescription:
fluidAdditionalAttributes:
required: required
validators:
-
identifier: NotEmpty
my result in frontend:
I was blind!!! Damn!
Sorry, for my stupid error. I forgot the ' ' at labelText, see below:
-
type: LinkedCheckbox
identifier: linkedcheckbox-1
label: ' Ja, ich habe die %s gelesen und bin mit der Verarbeitung meiner Daten einverstanden.'
properties:
pageUid: '17'
linkText: 'Datenschutzhinweise'
elementDescription:
fluidAdditionalAttributes:
required: required
validators:
-
identifier: NotEmpty
Related
I'm working on translating a TYPO3 form.
All works like a charm, only the defaultValue attibute don't.
This is the relevant part of the form definition:
`
renderingOptions:
templateVariant: version2
submitButtonLabel: Abschicken
type: Form
identifier: productformular
label: 'Formular Produktseite'
prototypeName: standard
renderables:
-
renderingOptions:
previousButtonLabel: 'Previous step'
nextButtonLabel: 'Neue Seite'
type: Page
identifier: page-1
label: Produktanfrage
renderables:
-
defaultValue: 'Guten Tag, ich interessiere mich für dieses Gerät. Bitte melden Sie sich schnellstmöglich bei mir.'
type: Textarea
identifier: textarea-1
label: Nachricht
properties:
fluidAdditionalAttributes:
placeholder: 'Ihre Nachricht an uns'
`
Unfortunately, I can't find a hint in any instructions on how to translate the defaultValue.
Has anybody a soilution for me?
I tryed something like
`
<trans-unit id="productformular.element.textarea-1.properties.label">
<source>Message</source>
</trans-unit>
<trans-unit id="productformular.element.textarea-1.properties.placeholder">
<source>Your message to us</source>
</trans-unit>
<trans-unit id="productformular.element.textarea-1.properties.defaultValue">
<source>Hello, I am interested in this device. Please contact me as soon as possible.</source>
</trans-unit>
`
Label and placeholder are translated, but defaultValue doesn't.
I am not aware of a solution with XLIFF. But you can use Form variants to override the defaultValue:
-
defaultValue: 'Max Powers'
identifier: name
label: Name
type: Text
variants:
- identifier: defaultValue-for-de
condition: 'siteLanguage("twoLetterIsoCode") == "de"'
defaultValue: 'Max Mustermann'
As described in Rustyjim's post, TYPO3 does not (yet) provide this possibility.
I didn't want different forms per language, also a javascript solution didn't seem to fit for this.
I solved it now using the form view helper and the standard fluid translate function:
<formvh:render
persistenceIdentifier="EXT:liftfinder/Resources/Private/Forms/productContactForm.form.yaml"
overrideConfiguration="{
renderables: {
0: {
renderables: {
4: {
defaultValue: '{f:translate(key: \'textarea-1_defaultValue\')}'
}
}
}
}
}"
/>
It's not really a good solution either, because the elements are addressed by a sequence number instead of a unique identifier.
Better solutions are welcome.
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
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"]'
I use locallang.xlf to translate my form (typo3 9.5.5, formextension).
my customform.yaml:
renderables:
-
properties:
fluidAdditionalAttributes:
required: required
validationErrorMessages:
-
code: 1221560910
message: 'My Custom Message'
code: 1221560718
message: 'My Custom Message'
-
code: 1347992400
message: 'My Custom Message'
-
code: 1347992400
message: 'My Custom Message'
options:
products: 'Products'
miscellaneous: 'Sonstiges'
prependOptionLabel: 'Please Specify'
type: SingleSelect
identifier: subject
label: 'Your Subject:'
validators:
-
identifier: NotEmpty
-
my locallang.xlf:
<trans-unit id="element.subject.properties.prependOptionLabel">
<source>Please Specify --Works!</source>
</trans-unit>
<trans-unit id="element.subject.properties.options.products">
<source>Products --Works!</source>
</trans-unit>
<trans-unit id="element.subject.properties.validationErrorMessages.message">
<source>Custom Message -Doesn't work!</source>
</trans-unit>
With an exact translation key it works, except validationErrorMessages.
Does anyone know how to translate these?
You can use the following translation keys for validation error codes. 1221559976 is the code for the EmailAddress validator:
<trans-unit id="validation.error.1221559976">
<source>Please enter valid email address. Thanks!</source>
<target>Bitte gebe eine gültige E-Mail-Adresse ein. Danke!</target>
</trans-unit>
<trans-unit id="MyContactForm.validation.error.1221559976">
<source>Please enter valid email address. Thank you very much!</source>
<target>Bitte gebe eine gültige E-Mail-Adresse ein. Vielen herzlichen Dank!</target>
</trans-unit>
The latter will override the first, as it contains the form identifier and is therefore more specific.
Keep in mind that both of these translation keys will not work if you already set a custom message in your form definition!
This means, the last three lines of the following example have to be removed:
renderables:
-
defaultValue: ''
identifier: email
label: Email
type: Text
properties:
fluidAdditionalAttributes:
placeholder: 'Email address'
### Don't set this if you want to translate the message:
#validationErrorMessages:
# - code: 1221559976
# message: 'Please enter a valid email address, dear.'
I'm working on translating my Typo3 page.
Now I've come to my contact form which I want to translate. From the Typo3 Documentation I've found that I need something like this:
contact.element.subject.properties.fluidAdditionalAttributes.placeholder
...as the translation ID inside my locallang.xlf file. I've linked my CustomFormSettings.yaml via TypoeScript, in there set the translation path to my extension and created a contact form.
I was actually able to translate the submit button for example and other buttons. But I can't get the placeholder inside my contact form to get translated, they all fallback to the value set in the contact form not the translation.
I'm guessing I'm handling the fluidAdditionalAttributes property wrong but I've tested lots of other combinations then the above.
What is the exact line I have to type inside my translation ID?
Here is my complete contact form:
renderingOptions:
submitButtonLabel: Submit
identifier: contact
label: Contact
type: Form
prototypeName: frameform
finishers:
-
options:
subject: 'Your message: {subject}'
recipientAddress: mail#mail.com
recipientName: 'Recipient Name'
senderAddress: '{email}'
senderName: '{name}'
replyToAddress: ''
carbonCopyAddress: ''
blindCarbonCopyAddress: ''
format: html
attachUploads: true
translation:
language: ''
identifier: EmailToReceiver
-
options:
subject: 'We have received: {subject}'
recipientAddress: '{email}'
recipientName: '{name}'
senderAddress: mail#mail.com
senderName: 'Sender Name'
replyToAddress: ''
carbonCopyAddress: ''
blindCarbonCopyAddress: ''
format: html
attachUploads: true
identifier: EmailToSender
-
options:
pageUid: '7'
additionalParameters: ''
identifier: Redirect
renderables:
-
renderingOptions:
previousButtonLabel: 'Previous step'
nextButtonLabel: 'Next step'
identifier: mainPage
type: Page
renderables:
-
defaultValue: ''
identifier: name
label: Name
type: Text
properties:
fluidAdditionalAttributes:
placeholder: Name
required: required
validators:
-
identifier: NotEmpty
-
defaultValue: ''
identifier: subject
label: Subject
type: Text
properties:
fluidAdditionalAttributes:
placeholder: Subject
required: required
validators:
-
identifier: NotEmpty
-
defaultValue: ''
identifier: email
label: Email
type: Text
properties:
fluidAdditionalAttributes:
placeholder: 'Email address'
required: required
validators:
-
identifier: NotEmpty
-
identifier: EmailAddress
-
defaultValue: ''
identifier: message
label: Message
type: Textarea
properties:
fluidAdditionalAttributes:
placeholder: Message
required: required
minlength: '10'
maxlength: '512'
validators:
-
identifier: NotEmpty
-
options:
minimum: '10'
maximum: '512'
identifier: StringLength
-
renderingOptions:
previousButtonLabel: 'Previous step'
nextButtonLabel: 'Next step'
identifier: summarypage
label: 'Summary page'
type: SummaryPage
You can override your placeholders in a locallang.xlf like this: element.<field-identifier>.properties.placeholder
example:
<trans-unit id="element.firstname.properties.placeholder">
<source>Your first name</source>
<target>Ihr Vorname</target>
</trans-unit>
I'm using the Typo3 form-module (sysext) with two email-finishers: EmailToReceiver vs. EmailToSender. I set up a custom mailtemplate, but
HOW can I select different mailtemplates for this two different mails?
OR is there another way to send two different mails?
In addition to Mathias Brodala's correct answer, you can also use templateName and templateRootPaths inside each email finisher. It will respect the email format you set with options.format if configured like below:
finishers:
-
identifier: EmailToReceiver
options:
subject: 'E-Mail from website'
recipientAddress: your.company#example.com
recipientName: 'Your Company name'
senderAddress: '{email}'
senderName: '{lastname}'
replyToAddress: ''
carbonCopyAddress: ''
blindCarbonCopyAddress: ''
format: html
attachUploads: 'true'
templateName: '{#format}.html'
templateRootPaths:
20: 'EXT:your_extension/Resources/Private/Forms/Emails/Receiver/'
translation:
language: ''
-
identifier: EmailToSender
options:
subject: 'Your message'
recipientAddress: '{email}'
recipientName: '{lastname}'
senderAddress: your.company#example.com
senderName: 'Your Company name'
replyToAddress: ''
carbonCopyAddress: ''
blindCarbonCopyAddress: ''
format: html
attachUploads: 'true'
templateName: '{#format}.html'
templateRootPaths:
20: 'EXT:your_extension/Resources/Private/Forms/Emails/Sender/'
According to the file paths set above, the templates are then saved in
your_extension/Resources/Private/Forms/Emails/Sender/
Html.html or Plaintext.html
your_extension/Resources/Private/Forms/Emails/Receiver/
Html.html or Plaintext.html
The complete tutorial can be found here.
On GitHub is a working TYPO3 extension with several example forms, including a form with custom mail template only for the sender.
You can use the templatePathAndFilename finisher option to set a custom template for your mails. You can set this for each finisher separately:
finishers:
- identifier: EmailToReceiver
options:
# ...
templatePathAndFilename: EXT:my_site/Resources/Private/Templates/.../EmailToReceiver.html
- identifier: EmailToSender
options:
# ...
templatePathAndFilename: EXT:my_site/Resources/Private/Templates/.../EmailToSender.html