2

在我的 TCA 表单中,我有两个下拉列表,List 1 calledCampus和 List 2 called Department。该Department列表应根据列表中选择的值而改变Campus。换句话说,Department列表取决于所选Campus项目。

如何在 TYPO3 TCA 表格中实现这一点?通常在 HTML 中,我会使用 AJAX,我应该在这里使用什么?

提前致谢 :)

4

1 回答 1

0

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';
于 2013-07-05T09:48:55.750 回答