Christian
Christian

Reputation: 4641

Typo3 TCA Select field should fill value instead of id

I am developing an extension in Typo3 v6. In the backend I want to show a selectfield taking the values from another table but filling the value (text) into the table instead of the ID. Here is my code (catlabel should be filled into the advert-table):

    'categoryname' => array(
        'exclude' => 0,
        'label' => 'LLL:EXT:myextension/Resources/Private/Language/locallang_db.xlf:tx_myextension_domain_model_advert.categoryname',
        'config' => array(
            'type' => 'select',
            'allowNonIdValue' => true,
            'size' => 1,
            'foreign_table' => 'tx_myextension_domain_model_categoryoption',
            'foreign_field' => 'catlabel'
        ),

Upvotes: 2

Views: 1897

Answers (2)

padina
padina

Reputation: 1

The itemsProcFunc won't work in my case. It stored the id in the database every time.

The hooks wont work.

I use the type 'user' and build everything by myself. https://docs.typo3.org/typo3cms/TCAReference/Reference/Columns/User/Index.html It's a little bit more complicated. But if you inject the needed repository in your classs and define all needed parameter in the tca, it build in acceptable time.

Upvotes: 0

cweiske
cweiske

Reputation: 31078

This is not possible with the stock functionality. You need to provide a itemsProcFunc that provides the keys and values for the select field. See the docs for more info.

Upvotes: 2

Related Questions