Zum Inhalt springen

Select Options abhängig von ausgewähltem Feld

Erstellt am 2. März 2018 · 3 Antworten · letzte Antwort am 14. März 2018

Tags: TCA, TYPO3 8, Frage

anisie ·

Hey,

ich habe drei Models - Feature, Category und Machine. Jede Category hat mehrere Features und jede Machine hat eine Category. Nun möchte ich erreichen, dass wenn ich beim Erstellen eines Machine-Records die Kategorie wechsel, dass mir die jeweiligen Features in einem Inline mit Select zur Auswahl stehen. Ich habe folgende TCA-Settings:

<?php

return [
    
    ...
    
    'columns' => [
        
        ...
        
        'category' => [
            'exclude' => false,
            'label' => 'Category',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'foreign_table' => 'tx_myext_domain_model_category',
                'minitems' => 0,
                'maxitems' => 1,
            ],
        ],
        
        'machine_features' => [
            'exclude' => false,
            'label' => 'Features',
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'tx_myext_machine_feature_mm',
                'foreign_field' => 'uid_machine',
                'foreign_label' => 'uid_feature',
                'foreign_selector' => 'uid_feature',
                'foreign_unique' => 'uid_feature',
                'foreign_sortby' => 'sorting',
            ],
        ],
        
        ...

    ],
];
<?php

return [

    ...

    'columns' => [
        'uid_machine' => [
            'label' => 'Machine',
            'config' => [
                'type' => 'select',
                'foreign_table' => 'tx_myext_domain_model_machine',
                'size' => 1,
                'minitems' => 0,
            ],
        ],
        'uid_feature' => [
            'label' => 'Feature',
            'config' => [
                'type' => 'select',
                'foreign_table' => 'tx_myext_domain_model_feature',
                'size' => 1,
                'minitems' => 0,
            ],
        ],
        'value' => [
            'label' => 'Value',
            'config' => [
                'type' => 'input',
            ],
        ],
    ],

    ...

];

Ich bekomme es aber leider nicht hin, dass die Features für die ausgewählte Category in das Select im Inline dargestellt werden. Es stehen mir immer alle Features zur Auswahl. Habt ihr eine Idee wie ich mein Ziel realisieren kann?

Ich bedanke mich schon im Voraus.

LG

anisie ·

Bisher habe ich noch keine Lösung gefunden. Hab das Problem erst einmal an das Ende verschoben. Werde mir nun einmal den Link von freeatweb ansehen. Hooks habe ich mir bisher noch gar nicht angesehen. Bin gespannt.

LG