Use route in Link/ActionViewHelper in form template?

Hi at all,

I have overridden a form template as described here:
https://flow-form-framework.readthedocs.org/en/latest/adjusting-form-output.html#changing-the-form-layout

My template looks something like this:

{namespace form=TYPO3\Form\ViewHelpers}
<form:form action="index" object="{form}" method="post" id="{form.identifier}" enctype="multipart/form-data" class="form-horizontal">
    <form:renderRenderable renderable="{form.currentPage}" />
    <div class="actions">
        <f:render partial="Acme.Project:Navigation" arguments="{form: form}" />
        <f:link.action action="list" controller="MyController" package="Acme.Project" subpackage="Backend" class="btn btn-default">cancel</f:link.action>
    </div>
</form:form>

Unfortunately the link.action ViewHelper doesn’t render my route as expected but like this:

dev.project.localhost/current/form/route?--myobject%5B%40action%5D=list&--myobject%5B%40controller%5D=mycontroller&--myobject%5B%40package%5D=acme.project&--myobject%5B%40subpackage%5D=backend

Same, but better readable:

dev.project.localhost/current/form/route?--myobject[@action]=list&--myobject[@controller]=mycontroller&--myobject[@package]=acme.project&--myobject[@subpackage]=backend

I have found out that in TYPO3\Flow\Mvc\Routing\UriBuilder class the namespace of the subrequest is added (which is “–myobject” in my case):

public function uriFor($actionName, $controllerArguments = array(), $controllerName = NULL, $packageKey = NULL, $subPackageKey = NULL) {
   
  // ...

   $controllerArguments = $this->addNamespaceToArguments($controllerArguments, $this->request);
   return $this->build($controllerArguments);
}

Is there a possibility to tell the link.action ViewHelper that it should not use the subrequest namespace?

Thanks in advance!

Hi Katharina

Did you try using the useParentRequest argument of the view helper?

Oh no! :smile:
I must have been blind!

Thank you for your quick answer! It works now.