Feature #82074

EXT:form: Support for conditions in form configuration

Added by Thorben Nissen 14 days ago. Updated 13 days ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
-
Start date:
2017-08-10
Due date:
% Done:

0%

PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Comparing EXT:form framework with formhandler, as the last one is dead now with CMS 8, I'm missing some features. One of them is using conditions in the form configuration, allowing to change form behaviour based on e.g. field values, environment variables or application context.

Possible scenarios for this are:
  • Change validation rules, based on a field value, e.g. a certain value from a select field
  • Change redirect page (for redirect finisher) based on a certain selection
  • Add additional finisher (e.g. newsletter subscription) if the checkbox (I like to receive the newsletter) is checked

This is of course nothing to be used with the backend editor. This is only necessary and usable with more complex forms, that are not editable in the backend anyway.
The conditions should be placed on the form configuration's root level and look like this:

conditions:
  -
    condition: 'FIELD:signup:==:yes'
    then:
      finishers:
        1:
          options:
            pageUid: 287
    else:
      finishers:
        1:
          options:
            pageUid: 288
  -
    condition: 'applicationContext:Development*'
    then:
      finishers:
        1:
          options:
            pageUid: 304
  -
    condition: 'AND'
    conditions:
      -
        condition: 'FIELD:signup:==:no'
      -
        condition: 'OR'
        conditions:
          -
            condition: 'applicationContext:Production*'
          -
            condition: 'applicationContext:Development*'
    then:
      finishers:
        1:
          options:
            pageUid: 305

We had a little discussion about this in the slack channel about placing the condition at each item separately instead of the root level. But first this would make the parsing much more complicated and second would this bloat the configuration even more. In most cases, would one condition(-tree) not only effect one setting but more, so the root level approach would be much better in that case.

It would be very helpful, if this would be backported to CMS 8, so we have a better replacement to formhandler.

History

#1 Updated by Gerrit Code Review 14 days ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53672

#2 Updated by Gerrit Code Review 14 days ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53672

#3 Updated by Thorben Nissen 14 days ago

  • Category set to Form Framework

#4 Updated by Gerrit Code Review 13 days ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53672

Also available in: Atom PDF