最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

TYPO3 Formframework howto render form with viewhelper - Stack Overflow

programmeradmin0浏览0评论

In my TYPO3 instance there are formdefinitions. I would like to render them in a fluid template. In the manual I found this:

<html xmlns:f="; xmlns:formvh="; data-namespace-typo3-fluid="true">

<formvh:render persistenceIdentifier="mycustomform.form.yaml" />

<f:comment>and so on</f:comment>

This works in so far as the form is displayed. But the controller and the action do not point to the FormFrontend controller and the perform action, but to the controller and the action of the extension the formviewhelper is implemented in.

The result is that the finisher configurations of mycustomform.form.yaml are ignored and the input values of the form are not accessible in the controller action.

With overrideConfiguration I can define the action but I found no way to define the controller.

Here is the relevant fluid code snippet:

<formvh:render
    persistenceIdentifier="EXT:custom_forms/Resources/Private/Form/Definitions/workshopform.form.yaml"
    overrideConfiguration="{
        renderingOptions: {
            controllerAction: 'perform',
            additionalParams: {
                'tx_myextension_show[event]': event.uid
            }
        },
        renderables: {
            0: {
                renderables: {
                    1: {
                        defaultValue: firstnamePreset
                    },
                    2: {
                        defaultValue: lastnamePreset
                    },
                    3: {
                        defaultValue: emailPreset
                    }
                }
            }
        }
    }"
/>

As you can see, I am able to define some preset values. This works fine.

The form action attribute is:

/myformpage?tx_myextension_show%5Baction%5D=perform
&tx_myextension_show%5Bcontroller%5D=Event
&tx_myextension_show%5Bevent%5D=5883
&cHash=e9a14175bf46ce7c4b36a44a6c1a1c9f#mycustomform

It should be:

/myformpage?tx_form_formframework%5Baction%5D=perform
&tx_form_formframework%5Bcontroller%5D=FormFrontend
&cHash=267454b014354e051279c2f58506e540#mycustomform

How can this be achieved?

In my TYPO3 instance there are formdefinitions. I would like to render them in a fluid template. In the manual I found this:

<html xmlns:f="http://typo3./ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:formvh="http://typo3./ns/TYPO3/CMS/Form/ViewHelpers" data-namespace-typo3-fluid="true">

<formvh:render persistenceIdentifier="mycustomform.form.yaml" />

<f:comment>and so on</f:comment>

This works in so far as the form is displayed. But the controller and the action do not point to the FormFrontend controller and the perform action, but to the controller and the action of the extension the formviewhelper is implemented in.

The result is that the finisher configurations of mycustomform.form.yaml are ignored and the input values of the form are not accessible in the controller action.

With overrideConfiguration I can define the action but I found no way to define the controller.

Here is the relevant fluid code snippet:

<formvh:render
    persistenceIdentifier="EXT:custom_forms/Resources/Private/Form/Definitions/workshopform.form.yaml"
    overrideConfiguration="{
        renderingOptions: {
            controllerAction: 'perform',
            additionalParams: {
                'tx_myextension_show[event]': event.uid
            }
        },
        renderables: {
            0: {
                renderables: {
                    1: {
                        defaultValue: firstnamePreset
                    },
                    2: {
                        defaultValue: lastnamePreset
                    },
                    3: {
                        defaultValue: emailPreset
                    }
                }
            }
        }
    }"
/>

As you can see, I am able to define some preset values. This works fine.

The form action attribute is:

/myformpage?tx_myextension_show%5Baction%5D=perform
&tx_myextension_show%5Bcontroller%5D=Event
&tx_myextension_show%5Bevent%5D=5883
&cHash=e9a14175bf46ce7c4b36a44a6c1a1c9f#mycustomform

It should be:

/myformpage?tx_form_formframework%5Baction%5D=perform
&tx_form_formframework%5Bcontroller%5D=FormFrontend
&cHash=267454b014354e051279c2f58506e540#mycustomform

How can this be achieved?

Share Improve this question asked Jan 31 at 11:09 Stefan PadbergStefan Padberg 5272 silver badges20 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

In your perform action make a forward to the show action. The single view is reloaded and the form shows the next step or performs the finishers.

public function performAction(): ResponseInterface
{
    return new ForwardResponse('show');
}
发布评论

评论列表(0)

  1. 暂无评论