Flexform displayCond with OR relation

I saw an interesting behaviour in a plain 6.2.4 TYPO3 installation, where I need to test an extension.

Problem:
I need a Front End plugin with flexform, which shows one selectbox (renderType) and depending on its value a second selectbox.
The rule is, if the renderType  is 2 OR 3 show the other field.

I have searched for a solution to get a flexform condition with an OR relation and I’ve found this suggestion:

<displayCond>
    <OR>
        <numIndex>FIELD:settings.renderType:=:3</numIndex>
        <numIndex>FIELD:settings.renderType:=:2</numIndex>
    </OR>
</displayCond>

But it did not help, because I saw the box by the value of 2 but not by 3. It seems it uses the latest condition.

The solution for that is to use a nested OR:

<displayCond>
    <OR>
        <numIndex>FIELD:settings.renderType:=:3</numIndex>
        <OR>
            <numIndex>FIELD:settings.renderType:=:2</numIndex>
        </OR>
    </OR>
</displayCond>

… or simply define the index for the numIndex attribute. (It is important, they should be different)

<displayCond>
    <OR>
        <numIndex index="0">FIELD:settings.renderType:=:0</numIndex>
        <numIndex index="1">FIELD:settings.renderType:=:5</numIndex>
    </OR>
</displayCond>

And here we are, the selectbox shows up if the renderType is 2 or 3

Veröffentlicht unter TYPO3 Technik
Ein Kommentar auf “Flexform displayCond with OR relation
  1. David Bruchmann sagt:

    Discovering the option OR closed my eyes for a much easier solution. With the following method you never need OR and only one line:

    FIELD:settings.renderType:IN:0,2,4,5

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

*