#83848f:form overrides array
Description
my html:
<f:form action="change" controller="Folder" objectName="folders" object="{Folders}" enctype="multipart/form-data" >
<f:form.textfield id="hFunc" property="hFunc" />
<f:form.textfield id="hPath" property="hPath" size="50" />
<hga:folder folders="{Folders}" />
<f:form.submit id="submit" value="Submit" />
</f:form>
This is the part of the listAction
$this->view->assign('Folders', $folders);
$folders is a multidimensional array, which inludes the folder structure of fileadmin.
If I get the change action called, the array $folders includes only ‘hFunc’ and ‘hPath’. The origional array $folders is gone!
On the beginning I used the folder names as keys and added a new array for each subfolder to the folder.
After changing to only add arrays without key names, it is not woking anymore. Key are now 0, 1, 2, …
and each folder-array has four sub values ([‘N’], [‘P’] ,[‘F’] [‘A’] where N and P have strings, F a int and A a array(s), if a Sub folder(s) exist.
in the html there are href with onclick to js functions which put strings in hFunc and hPath and creates click() for the submit button.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
History 1
-
Benni Mack commented and changed status
NewClosed <span data-processor="relativetime" data-value="2026-11-09T16:22:38+00:00" > 11/09/26, 16:22 </span>
Thanks for the report, and sorry it took so long to get an answer.
This is expected behaviour rather than a bug. The object=”{Folders}” argument of <f:form> only pre-fills the form fields with values; the bound object itself is not transferred to the next request. On submit, the browser sends only the fields that exist in the form, here folders[hFunc] and folders[hPath], and Extbase maps exactly that data to the “folders” argument.</f:form>
A domain object would at least carry an __identity field so Extbase could load it again, but a plain array has no identity, so nothing beyond the submitted fields can be restored.
If you need the folder structure in the target action, build it again on the server (as your list action already does), or render the parts you need as (hidden) form fields.
I’m closing this issue. For further help, please use the TYPO3 Slack (#typo3-cms) or Stack Overflow.