使用AJAX作为下拉列表的TYPO3 TCA表单 [英] TYPO3 TCA forms using AJAX for drop down lists

查看:119
本文介绍了使用AJAX作为下拉列表的TYPO3 TCA表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆