Bug #90768

Flexform nested displayCond

Added by Alexander König 7 months ago. Updated 7 months ago.

Status:
Accepted
Priority:
Should have
Assignee:
-
Category:
-
Target version:
Start date:
2020-03-16
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
7.3
Tags:
flexform condition displaycond
Complexity:
Is Regression:
Sprint Focus:

Description

Hi,

we've got an issue with nested flexform conditions, this issue is also descriped in this https://forge.typo3.org/issues/82499 bugreport.
We want to use this nested condition:

 <OR>
    <AND>
      <numindex index="0">FIELD:general.settings.flexForm.progMode:=:showEducationList</numindex>
      <numindex index="1">FIELD:settings.flexForm.orgUid:REQ:false</numindex>
    </AND>
    <AND>
      <numindex index="0">FIELD:settings.flexForm.progMode:=:showEducation</numindex>
      <numindex index="1">FIELD:settings.flexForm.eduOrgUid:REQ:false</numindex>
    </AND>
  </OR>

Only the second "AND"-Block is evaluated, since this one will overwrite the first AND-block, when its pared into an array (info from linked bugreport).
Is there an other way to write this condition?


Related issues

Related to TYPO3 Core - Bug #82499: displayCond - Problem with multiple conditions Closed 2017-09-17

History

#1 Updated by Alexander König 7 months ago

  • Subject changed from Flexform nested conditions to Flexform nested displayCond

#2 Updated by Georg Ringer 7 months ago

  • Related to Bug #82499: displayCond - Problem with multiple conditions added

#3 Updated by Georg Ringer 7 months ago

  • Status changed from New to Accepted
  • Target version set to next-patchlevel
  • Tags set to flexform condition displaycond

#4 Updated by Harald Witt 7 months ago

Hi,
wrapping the <AND>s inside the <OR> with a <numindex> solves the problem for now.

<displayCond>
  <OR>
    <numindex index="0">
      <AND>
        <numindex index="0">FIELD:general.settings.flexForm.progMode:=:showEducationList</numindex>
        <numindex index="1">FIELD:general.settings.flexForm.orgUid:REQ:false</numindex>
      </AND>
    </numindex>
    <numindex index="1">
      <AND>
        <numindex index="0">FIELD:general.settings.flexForm.progMode:=:showEducation</numindex>
        <numindex index="1">FIELD:general.settings.flexForm.eduOrgUid:REQ:false</numindex>
      </AND>
    </numindex>
  </OR>
</displayCond>

This also works with other nested condition-constructs like:

<displayCond>
  <OR>
    <numindex index="0">FIELD:whatever:IN:1,3,7</numindex>
    <numindex index="1">
      <AND>
        <numindex index="0">FIELD:general.settings.flexForm.progMode:=:showEducation</numindex>
        <numindex index="1">FIELD:general.settings.flexForm.eduOrgUid:REQ:false</numindex>
      </AND>
    </numindex>
  </OR>
</displayCond>

Greeings
Harald

#5 Updated by Harald Witt 7 months ago

It's not a bug - it's a feature :-)

Hi, it's me again.

I think that Alexanders assumption (the second <AND> overwrites the first) is absolutely right. You ask me why?
The reason is, that every entry in a data-structure has always to be unique! Think about the <items>-array in a "select" inside TCA or flexform.

Thinking so, my purposed solution is NOT a workaround, but the normal case. And the bug is not a bug - it's a feature instead.
The only missing thing would be a better documentation with complex examples as above.

Greeetings
Harald

Also available in: Atom PDF