In my TCA forms I have two drop down lists, List 1 called Campus
and List 2 called Department
. The Department
list should change depending on the value selected in the Campus
list. In other words, the Department
list depends on the selected Campus
item.
How do I achieve this in TYPO3 TCA forms? Normally in HTML, I would use AJAX, what should I use here?
Thanks in advance :)
You can use markers in your "foreign_table_where"-string. One of them is the ###REC_FIELD_[fieldname]### marker.
Example:
'campus' => array(
'label' => 'campus',
'config' => array(
'type' => 'select'
)
'foreign_table' => 'tx_myext_domain_model_campus',
),
'department' => array(
'label' => 'department',
'config' => array(
'type' => 'select'
)
'foreign_table' => 'tx_myext_domain_model_department',
'foreign_table_where' => " AND tx_myext_domain_model_department.campus = '###REC_FIELD_campus###'"
)
Additionally you have to tell TCA that a change of your campus field requests an update.
In ext_tables.php:
$TCA['tx_myext_domain_model_example']['ctrl']['requestUpdate'] .= ',campus';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.