in2code / powermail_cond
Add conditions (via AJAX) to powermail forms for fields and pages
Installs: 372 355
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 14
Forks: 23
Open Issues: 15
Type:typo3-cms-extension
Requires
- php: ^8.1
- ext-json: *
- ext-pdo: *
- in2code/powermail: ^11.0 || ^12.0
- typo3/cms-core: ^12.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.10
- helhum/typo3-console: ^8.0
- helmich/typo3-typoscript-lint: ^3.1
- mikey179/vfsstream: ^1.6
- symfony/config: ^6.2
- typo3/cms-adminpanel: ^12.4
- typo3/cms-belog: ^12.4
- typo3/cms-extbase: ^12.4
- typo3/cms-extensionmanager: ^12.4
- typo3/cms-felogin: ^12.4
- typo3/cms-filelist: ^12.4
- typo3/cms-fluid-styled-content: ^12.4
- typo3/cms-frontend: ^12.4
- typo3/cms-info: ^12.4
- typo3/cms-install: ^12.4
- typo3/cms-lowlevel: ^12.4
- typo3/cms-recordlist: ^12.4
- typo3/cms-rte-ckeditor: ^12.4
- typo3/cms-scheduler: ^12.4
- typo3/cms-setup: ^12.4
- typo3/cms-t3editor: ^12.4
- typo3/cms-tstemplate: ^12.4
Replaces
- typo3-ter/powermail-cond: 11.2.4
This package is auto-updated.
Last update: 2024-12-04 14:35:06 UTC
README
Conditions for TYPO3 extension powermail. While a user fills out a form, some fields should disappear, while others should be visible.
⚠️ TYPO3 13 compatibility
See EAP page (DE) or EAP page (EN) for more information how to get access to a TYPO3 13 version
Screenshots
List of Conditions you can apply on the powermail form fields
is set
is not set
contains value
contains value not
is
is not
is greater than (numbers only)
is less than (numbers only)
contains value from field
contains not value from field
Quick installation
Quick guide:
- Just install this extension - e.g.
composer require in2code/powermail_cond
- Clear caches
- Add a powermail form to any page
- Add a new record from type "condition container" to a sysfolder and configure it
- Don't forget to include the static template from powermail_cond
- Don't forget to add jQuery to your frontend (if not yet installed)
Example routing configuration for TypeNum 3132:
...
rootPageId: 1
routes:
-
route: robots.txt
type: staticText
content: "Disallow: /typo3/\r\n"
routeEnhancers:
PageTypeSuffix:
type: PageType
default: /
index: ''
suffix: /
map:
condition.json: 3132
...
Trouble shoot: upload fields
For being able to evaluate the conditions on the backend the form data gets sent as payload to the conditions.json
route. In case of upload files (a.k.a [type=file]
) the entire set of selected files are being uploaded with every change of basically every input field. This is resource and time consuming.
In case you don't rely on upload field within your set of conditions you can exclude them from being sent to the backend. To do so just specify add a parameter data-powermail-cond-excluded-fields-selector
to the form template, e.g.
<f:form action="{action}" section="c{ttContentData.uid}" name="field" enctype="multipart/form-data" additionalAttributes="{vh:validation.enableJavascriptValidationAndAjax(form:form, additionalAttributes:{data-powermail-cond-excluded-fields:'.powermail_file'})}" >
Local Development and Contribution
There is a docker based local development environment available. See Readme.md for more information.
Less flickering
To prevent the flickering that occurs when loading a form with conditions the usually asynchronously loaded "condition JSON" can be rendered directly into the HTML source code via this viewhelper in your copy of EXT:powermail/Resources/Private/Templates/Form/Form.html
{namespace pc=In2code\PowermailCond\ViewHelpers} <script type="application/json" id="form-{form.uid}-actions">{pc:conditions(form:form) -> f:format.raw()}</script> <style type="text/css"> .powermail_fieldset { opacity: 0; visibility: hidden; transition: opacity 0.5s, visibility 0.5s; } </style>
This way the initial asynchronous call will be skipped which reduces the flickering to a minimum.
Early Access Programm for TYPO3 13 support
ℹ️ TYPO3 13 compatibility
See EAP page (DE) or EAP page (EN) for more information how to get access to a TYPO3 13 version
Changelog
More to come soon?
- Use vanilla JS instead of jQuery
Conflicts
- It's not possible to use powermail multistep forms with powermail_cond