Project

General

Profile

Actions

Feature #82074

closed

EXT:form: Support for conditions in form configuration

Added by Thorben Nissen over 6 years ago. Updated about 6 years ago.

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

0%

Estimated time:
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.

Actions

Also available in: Atom PDF