在我的 TCA 表单中,我有两个下拉列表,List 1 calledCampus
和 List 2 called Department
。该Department
列表应根据列表中选择的值而改变Campus
。换句话说,Department
列表取决于所选Campus
项目。
如何在 TYPO3 TCA 表格中实现这一点?通常在 HTML 中,我会使用 AJAX,我应该在这里使用什么?
提前致谢 :)
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';