Download the PHP package madj2k/t3-forminator without Composer
On this page you can find all versions of the php package madj2k/t3-forminator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download madj2k/t3-forminator
More information about madj2k/t3-forminator
Files in madj2k/t3-forminator
Package t3-forminator
Short Description This extension comes with several additional validators, finishers, formElements and general improvements for the usage of the typo3/cms-form-extension, e.g. improved ConfirmationMessage- and Email-Finisher, checkboxes with link-able labels for GDPR or terms & conditions, improved email-validation, validator for phone-numbers, ViewHelper for well formated plaintext-emails.
License GPL-2.0+
Homepage https://www.steffenkroggel.de
Informations about the package t3-forminator
EXT: forminator
This extension comes with several additional validators, finishers, formElements and general improvements for the usage of the typo3/cms-form-extension, e.g.
- improved ConfirmationMessage- and Email-Finisher
- checkboxes with link-able labels for GDPR or terms & conditions
- improved email-validation
- validator for phone-numbers
- ViewHelper for well formated plaintext-emails
- removes the annoying utility-classes (mb-3, mb-2) of the new default layout (layout2) of typo3/cms-form
- several JS functions for forms (reloadOnChange, submitOnChange, AJAX-submit, removal of error classes when user edits fields,...)
- JS-init for select2 elements
- Better-Resize-Event for handling the resize event only once on the end and smoothly on mobile devices
Installation
Simply install the extension and integrate the TypoScript of the extension into the root page of the website.
Basics
This extension removes the annoying utility-classes (mb-3, mb-2) of the new default layout (layout2) of typo3/cms-form. It also adds a basic grid-configuration.
Extended standard flexform for typo3/cms-form
The extension expands the standard form flexform to include the option of specifying the privacy policy page and the terms and conditions in the backend. This can be used for the corresponding consent checkboxes.
You can also define your own extensions to the form flexform via the extension configuration in BE (System -> Setup -> Extension Configuration). This is possible for all forms (*-wildcard) as well as for individual forms.
Example: Extension of the Flexform when the “my-form” form is selected with the fields defined in the “ExtensionFlexform.xml” file.
Important: Extension flexforms require a slightly different structure in order to work. An example can be found under [/Configuration/FlexForms/Extend/PrivacyExtend.xml]()
The settings are then added to the renderingOptions of the FormDefintion (via Render.html) and thus can be accessed via the settingsViewHelper:
Finishers
ConfirmationMessageFinisher
Adds the possibility to use additional fields from the flexForm to display a structured confirmation message.
This can be done by simply using the YAML-configuration using assignOptions
and FormEditor-configuration.
see: [/Configuration/Yaml/Finishers/ConfirmationMessage.yaml]()
EmailToReceiver / EmailToSender
Adds the possibility to use additional fields from the flexForm for usage in the email. This way you can add e.g. a message above the email-content.
This can be done by simply using the YAML-configuration using assignOptions
and FormEditor-configuration.
see: [/Configuration/Yaml/Finishers/EmailToSender.yaml]() & [/Configuration/Yaml/Finishers/EmailToReceiver.yaml]()
Validation
AlwaysFalse
The name says it all. This validator always returns false. It is used in the SkipValidation form element.
see: [/Configuration/Yaml/Validators/AlwaysFalse.yaml]()
BetterEmailAddressValidator
The email-validator from the core does not check for a FQDN. Thus it is possible to use an e-mail in the format "test@test". This validator fixes that.
see: [/Configuration/Yaml/Validators/BetterEmailAddress.yaml]()
PhoneValidators
Checks for valid phone numbers. You can enable / disable if the international area code is allowed.
see: [/Configuration/Yaml/Validators/BetterEmailAddress.yaml]()
FormElements
ConsentContainer / ConsentCheckbox
Adds a container-element and checkboxes for consent-handling (GDPR or terms & conditions). The labels of the checkboxes can be linked to defined pages and it is possible to a longer description above.
see: [/Configuration/Yaml/FormElements/ConsentCheckbox.yaml]() & [/Configuration/Yaml/FormElements/ConsentContainer.yaml]()
Configuration:
Translations:
Hcaptcha
Customized configuration for the use of dreistromland/typo3-hcaptcha and for usage together with the extension eliashaeussler/typo3-form-consent With the integrated ViewHelper it is also possible to use dreistromland/typo3-hcaptcha in AJAX-forms.
The configruation has to be imported separately, because it is optional. Just include this snippet in your configuration:
see: [/Configuration/Yaml/FormElements/Hcaptcha.yaml]()
Salutation
A ready to use select field with typical salutations.
see: [/Configuration/Yaml/FormElements/Salutation.yaml]()
SingleSelect / MultiSelect
Customized configuration for the use of select form elements with the jQuery framework select2
see: [/Configuration/Yaml/FormElements/SingleSelect.yaml]() & [/Configuration/Yaml/FormElements/MultiSelect.yaml]()
SkipValidation
In case you need to reload your form because of changes but don't want to validate it, this element is your friend. Just set the CSS-Class "js-forminator-reload-on-change" to the form-element you want to trigger the reload without validation. This way you can add fields or change required fields in a convenient way.
see: [/Configuration/Yaml/FormElements/SkipValidation.yaml]()
Configuration:
TextEmail
This form element can be used to add an email field without the standard validation. This allows the use of the BetterEmailAddressValidator integrated here
see: [/Configuration/Yaml/FormElements/TextEmail.yaml]()
Title
A ready to use select field with typical titles.
see: [/Configuration/Yaml/FormElements/Title.yaml]()
ViewHelpers
Configuration/AddToEmailFinisherAsReciever
This ViewHelper can be used to dynamically add further recipients to the finisher configuration of the email finisher after the form has been sent. dynamically with additional recipients. This is useful if, for example, the form is to be sent to different recipients based on a subject selected in the form. subject selected in the form is to be sent to different recipients. This ViewHelper can ideally be used together with the Record/GetByFormParamViewHelper.
Example: Individual recipient based on link via contact form
Step 1
Pass the ID of the contact data record via the GET parameter “contact” and include it as a hidden field TypoScript:
Schritt 2
Form YAML with hidden field:
Schritt 3
The contact data record is now loaded in Render.html after the form has been sent and added as a recipient for the e-mail finisher.
Email/PlaintextLineBreaksViewHelper
With this viewHelper it is possible to generate plaintext mails without having to take care of indentations or line-breaks. This is often a problem because if you e.g. use conditions in your plaintext mail-templates, the code quickly becomes unreadable. This viewHelper removes all indentations and line breaks you need for a readable code, but you can set line-breaks manually by simply writing "\n" into your templates.
Usage:
Result:
Record/GetByFormParamViewHelper
This ViewHelper loads a data record from any table based on a form parameter from the request object. This can be helpful if, for example, you want to select a specific contact address as the recipient for the finisher based on a selection of the topic after the form has been sent. The relevant data record can then be loaded. The field-parameter is optional. If not set, the whole record is returned as array.
See above!
Record/GetByIdentifierViewHelper
This ViewHelper loads a data record from any table based on a the value of the given form-field-identifier. This can be helpful if, for example, you want to display detail information of a database-record based on the value of a field in your form. The field-parameter is optional. If not set, the whole record is returned as array.
Record/GetByUidViewHelper
This ViewHelper loads a data record from any table based on a the value of the given uid. This can be helpful if, for example, you want to display detail information of a database-record based on a uid. The field-parameter is optional. If not set, the whole record is returned as array.
GetElementValueByIdentifier
It does what it names indicates: it returns the value of an formElement you specify by it's identifier.
SkipValidationViewHelper
In some cases it is necessary to reload a form to display fields that have dependencies on other fields. To do this, the form must be reloaded without starting the validation of the form. This is possible with the SkipValidation form element (see above).
This ViewHelper can be used to ensure that the form-fields do not contain any fields with CSS error classes after the form has been reloaded.
Example:
ExpressionLanguage
isNull
Sometimes it is necessary to check via a form-configuration (YAML) if a value is null - especially when working with GET-params. This can be done with this function.
The following example checks if a value is null and then sets the field to readonly.
Templates
Checkbox / MultiCheckbox / RadioButton
This extensions adds a span with the CSS-class "form-check-field" around the input[type="radio"] and input[type="checkbox"] that allows customized styling of the radios / checkboxes with CSS only:
Here an rudimentary example in SASS as prove of concept:
JS-Features
madj2k-better-resize-event.js
In some cases, you need to be able to react to the window's resize event. Unfortunately, however, the resize event is not only triggered at the end of the resizing of the browser window, but every time the size is changed in between. This can lead to an overhead if the event is handled every the event every time. With the JS-module, a final event is only triggered when the browser window has been resized.
The script also considers edge-cases such as showing the software-keyboard and showing / hiding the navigation bar on mobile devices (both trigger a resize event).
Integration
Integrate the JS file into the page.
Then instantiate the Madj2kBetterResizeEvent-module:
Usage
forminator.js
The JS module contains
- the initialization of customizable dropdowns with the jQuery plugin select2
- the handling of the resizing of customizable dropdowns with the jQuery plugin select2 in case of a resize-event of the window
- the CSS class “js-forminator-submit-on-change” can be used to submit a form as soon as the value of the field changes (submit-on-change)
- the CSS class “js-forminator-reload-on-change” can be used to submit a form and reload it without validation as soon as the value of the field changes (reload-on-change).
- ajax-submit for forms (requires helhum/typoscript-rendering)
- removal of error classes / error messages on fields when user edits these fields again
Integration
Important: The script requires jQuery. Integrate the JS-file into the page.
Then instantiate the forminator-module:
Usage with jQuery select2
Important: The script requires jQuery. Because it is possible to use the forminator without the select2 plugin, the init-functions for select2 have to be called explicitly.
Add the JS-file and CSS-files of select2 into your page:
Then initialize the select2-functions:
This extension automatically adds the relevant CSS-Classesfor select2 to work to all select-fields of the form-framework. However, if you want to use select2 apart from that, just add the following CSS-classes to your select-fields:
- "js-forminator-select2-multiple" for a multi-select
- "js-forminator-select2-single" for a single-select
Example:
Usage of Submit-On-Change
This is useful, for example, in the context of search forms that should automatically update the search results when a field is changed. To do this, simply add the CSS class “js-forminator-submit-on-change” to the element that is to submit the form in the event of an onChange event. This function is not necessarily linked to the form framework.
Usage of the CSS-class:
Usage of Reload-On-Change
Below is an example of its use in combination with SkipValidation.
In this example case, we have a form that offers two options. If the first option is selected, no information needs to be entered in the text field below. However, if the second option is selected, the text field below is a mandatory field. In order to realize this within the form framework, the form is then reloaded using the CSS-class “js-formiantor-reload-on-change” without triggering the validation of the form.
Usage in a form-configuration (YAML):
Usage of Ajax-Submit for forms
Important: this feature requries helhum/typoscript-rendering!
You simply have to add an data-action-attribute to your form. This automatically binds the ajax-function to your form.
The script automatically scrolls either to the top of the form OR to the first error-field of the form. You can deactivate this by adding the data-attribute "data-no-scroll-to" to your form.
You can also define a scroll-to-element by adding the data-attribute "data-scroll-to" with an element-id. In this case the script does not scroll to the top of the form but to the element defined. However, if there is a form-field with an error-class in the form, this takes precedence.
If you use the default configuration of typo3/cms-form with the new default layout (layout2), this should work out-of-the-box. If you use custom error-classes you can configure the error-class the script should use.
You also can configure an element which should be considered as offset for the scroll-to-functionality (e.g. a static header).
Usage of error-class removal on forms when user edits fields
If you use the default configuration of typo3/cms-form with the new default layout (layout2), this should work out-of-the-box.
However you can configure the relevant error-classes individually. The only important thing for it to work is that each element needs a the wrapping element with the defined error-class.
Features for eliashaeussler/typo3-form-consent
If you use eliashaeussler/typo3-form-consent, the forminator comes with some helpful features. It allows you to override the approval- and dismiss-messages via a flexform that is added to the opt-in-plugin. The forminator also comes with some helpful templates and partials for this purpose. The extension also contains a standard routing for the opt-in links.
All versions of t3-forminator with dependencies
typo3/cms-core Version ~10.4.0 || ~11.5.0 || ~12.4.0 || ~13.4.0
typo3/cms-form Version ~10.4.0 || ~11.5.0 || ~12.4.0 || ~13.4.0