Issue Bug Closed

#77097[__referrer][@request] is set only for the first form, when forms are generated in a f:for loop

Viktor Livakivskyi 07/14/16, 16:58 updated 10/02/18, 11:09

Description

Hi,

There is an issue with setting hidden referrer request field. When a form is placed standalone in a template, it contains a [__referrer][@request] in it. However, when a form is placed in a loop, only the first form contains referring request field.

Consider a following example:

<f:form action="anything" name="license" enctype="multipart/form-data">
    <f:form.textarea />
    <f:form.submit value="{f:translate(key: 'submit')}" />
</f:form>

<f:form action="anything" name="license" enctype="multipart/form-data">
    <f:form.textarea />
    <f:form.submit value="{f:translate(key: 'submit')}" />
</f:form>

<f:for each="{0: 'zero', 1: 'one'}" as="something">
    <f:form action="anything" name="license" enctype="multipart/form-data">
        <f:form.textarea />
        <f:form.submit value="{f:translate(key: 'submit')}" />
    </f:form>
</f:for>

Resulting output:
Form 1: contains [__referrer][request], because is placed standalone.
Form 2: contains [__referrer][
request], because is placed standalone.
Form 3: contains [__referrer][request], because is first in a loop.
Form 4: *doesn't contain* [__referrer][
request], because is second in a loop.

This results in different behavior in case of validation errors. First form from a loop will show validation errors at current page, while all the next forms will open resulting page and show a generic error message, like Validation failed while trying to call Vendor\Extensions\Controller\MyController->anythingAction().

TYPO3 7.6.9
Plugin’s actions (both: the one that shows a forms, and the one that is used as form’s target) are non-cacheable.

Reviews 4