如何为新对象有效调试 TYPO3-Fluid-Form?

How to effectively debug TYPO3-Fluid-Form for new object?

我有一个 "normal" 控制器用于一个名为 Application 的对象。这个对象变得相当复杂,并使用 ajax-validations 和大量 jQuery-functions 来验证 属性-values 等等。 不幸的是,我偶尔会从 processAction 中收到错误,告诉我未设置必要的参数 $newApplication。

Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1298012500: 
Required argument "newApplication" is not set for 
VENDOR\myExt\Controller\ApplicationController->process

新的应用程序对象正在从 newAction 传递到流体模板,就像在 TYPO3-docbase 的 Blog/Post 示例中显示的那样。

不幸的是,我无法找到原因,为什么流程操作不能正确地从表单中获取应用程序对象,因为它偶尔会发生(在生产系统的日志中获取错误)但我不能在我自己的测试客户端上重现它,在不同的浏览器上一切都按预期工作。另外,表格是public,所以我认为这不是与访问权限等相关的问题

关于如何有效调试这种情况的任何提示都将非常有帮助。 提前致谢,奥利弗

其他信息和代码:

<v:variable.set name="nationalityoptions" value="{v:variable.convert(value: {}, type: 'array')}" />

<div id="bewerbungsformcontent"  class="customerform">
<f:form id="newApplicationForm" name="newApplication" extensionName="myExt" object="{newApplication}" objectName="newApplication" controller="Application" action="process" enctype="multipart/form-data" method="post">
<div name="personaldatadiv" id="personal_data_div" class="applicationform_block_div">
        <h3><f:translate key="LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:personaldata-fieldset-title"/></h3>
        <p><label for=""><f:translate key="LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-title" /></label>
        <f:form.select id="applicationform_genderselect" name="title" class="form_select" property="title" options="{vendor:TcaOptions(property: 'title', subject: 'Car24\Car24\Domain\Model\Application')}" value="0" /><span class="required">*</span></p>
        <p><label for=""><f:translate key="LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-salutation" /></label>
        <f:form.select id="applicationform_salutationselect" name="salutation" class="form_select" property="salutation" options="{vendor:TcaOptions(property: 'salutation', subject: 'Car24\Car24\Domain\Model\Application')}" value="0" /></p>
        <p><label for=""><f:translate key="LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-forename" /></label>
        <f:form.textfield id="applicationform_forenameinput" name="forename" class="form_textinput" placeholder="{f:translate(key: 'LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-forename')}" property="forename" value="" required="true" /><span class="required">*</span></p>
        <p><label for=""><f:translate key="LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-name" /></label>
        <f:form.textfield id="applicationform_nameinput" name="name" class="form_textinput" placeholder="{f:translate(key: 'LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-name')}" property="name" value="" required="true" /><span class="required">*</span></p>
        <p><label for=""><f:translate key="LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-postalcode" /></label>
        <f:form.select options="{}" id="applicationform_postalnumberinput" name="addressPostalCity" class="form_select select2_plz" value="" /><span class="required">*</span></p>
        <p><label for=""><f:translate key="LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-street" /></label>
        <f:form.textfield id="applicationform_streetinput" name="addressStreet" class="form_select" placeholder="{f:translate(key: 'LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-street')}" property="addressStreet" value="" required="true" /><span class="required">*</span></p>
        <p><label for=""><f:translate key="LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-housenumber" /></label>
        <f:form.textfield id="applicationform_housenumberinput" name="addressNumber" class="form_textinput" placeholder="{f:translate(key: 'LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-housenumber')}" property="addressNumber" value="" required="true" /><span class="required">*</span></p>
        <p><label for=""><f:translate key="LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-country" /></label>
        <f:form.textfield id="applicationform_countryinput" name="addressCountry" class="form_textinput_readonly" property="addressCountry" required="true" value="{f:translate(key: 'LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-country-germany')}" readonly="true" tabindex="-1" /><span class="required">*</span></p>
        <p><label for=""><f:translate key="LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-birthdate" /></label>
        <f:form.textfield id="applicationform_birthdateselect" name="dateselect" class="form_dateselect" placeholder="dd.mm.yyyy" required="true" value="" /><span class="required">*</span></p>
        <p><label id="applicationform-label-reference" for="applicationform-referencenumber"><f:translate key="LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-origin" /></label>
        <f:form.select id="applicationform_originselect" name="nationality" class="form_select" property="nationality" options="{vendor:TcaOptions(property: 'nationality', subject: 'Car24\Car24\Domain\Model\Application')}"/><span class="required">*</span></p>
        <h3><f:translate key="LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationinfo-fieldset-contactinfo"/></h3>
        <h5><f:translate key="LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-phoneinfo"/></h5>
        <p><label for="applicationform_phonecodeinput"><f:translate key="LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-phone" /></label>
        <f:form.textfield id="applicationform_phonecodeinput" name="contactPhoneCode" property="contactPhoneCode" class="form_textinput" placeholder="{f:translate(key: 'LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-phonecode')}" value="" />
        <f:form.textfield id="applicationform_phoneinput" name="contactPhone" property="contactPhone" class="form_textinput" placeholder="{f:translate(key: 'LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-phone-number')}" value="" /><span class="required">*</span></p>
        <p><label for="applicationform_mobileinput"><f:translate key="LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-mobile" /></label>
        <f:form.textfield id="applicationform_mobileinput" name="contactMobile" class="form_textinput" property="contactMobile" placeholder="{f:translate(key: 'LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-mobile')}" value="" /><span class="required">*</span></p>
        <p><label for="applicationform_mailinput"><f:translate key="LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-mail" /></label>
        <f:form.textfield type="email" id="applicationform_mailinput" name="contactMail" class="form_textinput" property="contactMail" placeholder="{f:translate(key: 'LLL:EXT:vendor/Resources/Private/Language/locallang_applicationform.xlf:applicationform-mail')}" value="" required="true" /><span class="required">*</span></p>
    </div>
</f:form>
</div>

您很可能遇到以下问题之一:

  • 您的控制器操作需要一个对象作为参数,但是在您的 f:form 中您没有设置对象名称或者它设置为错误的名称。
  • 您的表单 posts 到另一个插件中的控制器操作,但您没有指定目标插件名称,因此接收插件不会读取请求参数。
  • 您正在 post 正在处理无法映射到正确目标对象类型的数据;例如,数据可能不完整,或者您正在 posting 一个不存在的对象标识符。
  • 您在某处重定向到需要参数但不包括参数的操作。

其中大部分归结为您构建模板的方式。经验法则:使用 objectproperty 属性保留尽可能多的表单组件,而不是手动创建字段名称。

在发生此故障时调试 $this->request 可能会产生更多信息,例如缺少参数值或发生重定向时的源操作。

仅当您 post 您的模板代码(具体来说,包括 f:form 标签在内的所有内容时,才能提供更多信息。仅供参考,使用 ajax 验证也可能导致实际验证要求与您执行的验证之间不同步 - 因此看似有效的对象在您的控制器映射和验证时可能无效。请注意,您在控制器中执行的任何重写也可能会影响验证和参数映射等行为。

编辑:显然,从您在上面 post 编辑的源代码中,您使用的是自定义表单 属性 names 而不是使用对象 属性。这确实会对控制器参数映射产生影响:您的字段将作为单独的 post 字段传递,而不是对象的属性。