Black
Black

Reputation: 20252

TCA displayCond - check if specific value in specific select box is set

I have defined a select like this in the TCA file of my model:

    'test' => array(
        'exclude' => 1,
        'label' => 'test',
        'config' => array(
            'type' => 'select',
            'items' => array(
                array("A", "A"),
                array("Foo", "FOO"),
        ...

The input field format should only appear in the backend, if the option "Foo" is selected.

Attempt 1:

    'format' => array(
        'displayCond' => 'FIELD:test.config.items:=:Foo',
    ...

Attempt 2:

    'format' => array(
        'displayCond' => 'FIELD:test:=:Foo',
    ...

Is this possible?

Upvotes: 1

Views: 1714

Answers (1)

Paul Beck
Paul Beck

Reputation: 2685

Attempt 2 looks correct to me. Did you add 'requestUpdate' => 'test' to the ['ctrl'] section of the TCA to make the form reload after changing the field "test"?

https://docs.typo3.org/typo3cms/TCAReference/7.6/Reference/Ctrl/Index.html?highlight=requestupdate#requestupdate

Upvotes: 3

Related Questions