in2code/powermail_cond

Add conditions (via AJAX) to powermail forms for fields and pages

Installs: 360 452

Dependents: 0

Suggesters: 0

Security: 0

Stars: 8

Watchers: 14

Forks: 23

Open Issues: 23

Type:typo3-cms-extension

11.2.3 2024-09-20 13:54 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

Example form with conditions

Backend view to records

Backend view to records with rule

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
...

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