使用AJAX作为下拉列表的TYPO3 TCA表单 [英] TYPO3 TCA forms using AJAX for drop down lists
问题描述
在我的TCA表格中,我有两个下拉列表,列表1名为校园
和名为部门
的列表2。 部门
列表应根据在校园
列表中选择的值进行更改。换句话说,部门
列表取决于所选的校园
项目。
我如何在TYPO3 TCA表格中实现这一点?通常在HTML中,我会使用AJAX,我应该在这里使用什么?
在此先感谢:)
你的foreign_table_where字符串。
其中之一是### REC_FIELD_ [fieldname] ###标记。
示例:
'campus'=>数组(
'label'=>'campus',
'config'=>数组(
'type'=>'select'
)
'foreign_table'=>'tx_myext_domain_model_campus',
),
'department'=>数组(
'label'=>'department',
'config'=>数组(
'type'=>'select'
)
'foreign_table'=>'tx_myext_domain_model_department',
'foreign_table_where'=>AND tx_myext_domain_model_department.campus ='### REC_FIELD_campus ###'
)
另外,你必须告诉TCA校园字段的更改要求更新。
在ext_tables.php中:
$ TCA ['tx_myext_domain_model_example'] ['ctrl'] ['requestUpdate']。= ',校园';
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';
这篇关于使用AJAX作为下拉列表的TYPO3 TCA表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!