简体   繁体   English

TYPO3扩展名输入表单无法保存对象

[英]TYPO3 extension input form cannot save object

I am currently developing an extension where I want to create a new object ( request ) which contains a reference (UID) to a second object ( bike ). 我目前正在开发一个扩展,我想在其中创建一个新对象( request ),该对象包含对第二个对象( bike )的引用(UID)。 Simply put, I want to submit a contact form that references the corresponding product. 简而言之,我想提交一个引用相应产品的联系表格。

It is already possible to create a request object in the backend. 已经可以在后端创建一个请求对象。

But when I try to submit the frontend contact form, I get the following error: 但是,当我尝试提交前端联系表时,出现以下错误:

#1298012500: Required argument "bike" is not set.

Here an excerpt from the input form ( New.html ): 以下是输入表单( New.html )的摘录:

<f:form id="request" class="Tx-Formhandler col col-2" action="create" name="newRequest" object="{newRequest}">

            <div class="content">

                <f:form.hidden property="bike" value="{bike.uid}"/>

                <div class="row"> 
                    <div class="col c3">
                        <label for="salutation"><f:translate key="tx_chiliusedbikes_domain_model_request.salutation" />:</label>
                    </div>
                    <div class="input col c9">
                        <f:form.select property="salutation" options="{Herr: 'Herr', Frau: 'Frau'}" />
                    </div>
                </div>
                <div class="row required">
                    <div class="col c3">
                        <label for="firstname"><f:translate key="tx_chiliusedbikes_domain_model_request.firstname" />: *</label>
                    </div>
                    <div class="input col c9">
                        <f:form.textfield property="firstname" class="required" />
                    </div>
                </div>

The UID of the bike is correctly passed into the form. 自行车的UID已正确传递到表单中。 But still, the error states that the property is not set. 但仍然,错误指出该属性未设置。 What could be the reason? 可能是什么原因?

Seemingly, the problem was caused by the missing attribute controller of the form. 看来,问题是由表单的属性controller缺失引起的。 Now it works flawlessly: 现在它可以完美地工作了:

<f:form id="request" class="Tx-Formhandler col col-2" action="create" name="newRequest" object="{newRequest}" controller="Request">

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

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