Issue Feature Closed

#24925Mandatory for Selectbox with TCA not possible

Noel Bossart 02/02/11, 09:29 updated 10/02/18, 12:40

Description

It’s not possible to create a backend Selectbox that is mandatory with only 1 Item selectable:

‘config’ => array(
‘type’ => ‘select’,
‘size’ => 5,
‘autoSizeMax’ => ‘12’,
‘minitems’ => 1,
‘maxitems’ => 1,
…
)

It’s only possible if the ‘maxitems’ is set to 2 which might not be the correct setting.

‘category’ => array(
‘exclude’ => 0,
‘label’ => ‘LLL:EXT:myext/Resources/Private/Language/locallang_db.xml:tx_myext_domain_model_event.category’,
‘config’ => array(
‘type’ => ‘select’,
‘size’ => 5,
‘autoSizeMax’ => ‘12’,
‘minitems’ => 1,
‘maxitems’ => 1,
‘foreign_table’ => ‘tx_myext_domain_model_category’,
‘foreign_table_where’ => ‘AND tx_myext_domain_model_category.pid=###CURRENT_PID###’,
‘foreign_sortby’ => ‘sorting’,
‘MM’ => ‘tx_myext_event_category_mm’,
‘eval’ => ‘trim,required’,
),
),

Value is not mandatory

Tested in 4.4 and 4.5, also lot’s of reports online that it’s not possible… (or at least there is no obvious and documented way to do it.)
(issue imported from #M17440)

Reviews 3