简体   繁体   English

TYPO3 TCA 和 select 形式

[英]TYPO3 TCA and select form

I try to get values for my tca:我尝试为我的 tca 获取值:

'config' => [
    'type' => 'select',
    'renderType' => 'selectSingle',
    'items' => [
        ['Herr', 0],
        ['Frau', 1]
    ],
    'size' => 1,
    'maxitems' => 2,
    'eval' => 'required'
],

my form.html has this select types:我的表格.html 有这个 select 类型:

<label>Anrede</label>
<f:form.select name="salutation" class="form-control">
    <f:form.select.option value="0">Herr</f:form.select.option>
    <f:form.select.option value="1">Frau</f:form.select.option>
</f:form.select>

but i get always the first item: Herr, can somebody tell me what i am doing wrong?但我总是得到第一个项目:先生,有人可以告诉我我做错了什么吗?

For frontend forms with Extbase you will need a proper TypoScript conffiguration, a PHP newAction and/or createAction method and your Fluid template.对于带有 Extbase 的前端 forms,您将需要适当的 TypoScript 配置、PHP newAction 和/或 createAction 方法以及您的 Fluid 模板。

Based on the additional information now there are two options that came to my mind:根据现在的附加信息,我想到了两个选项:

  • Either the validation and storage of your form values is not configured properly, so they will be removed on the way to the database.表单值的验证和存储配置不正确,因此它们将在进入数据库的途中被删除。
  • Or you might have rendered the field twice with the same name in the frontend form, thus making the last entry the winner.或者您可能在前端表单中使用相同的名称两次呈现该字段,从而使最后一个条目成为赢家。

So please double check the fields first before digging deeper into the storage process.因此,在深入研究存储过程之前,请先仔细检查字段。

https://docs.typo3.org/m/typo3/book-extbasefluid/master/en-us/7-Controllers/1-Creating-Controllers-and-Actions.html https://docs.typo3.org/m/typo3/book-extbasefluid/master/en-us/7-Controllers/1-Creating-Controllers-and-Actions.ZFC35FDC70D5FC69D2569E08Z8

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM