Search code examples
phpfluidtypo3-flow

get element from session and fill out form


I am trying to assign an object to a view from the session in the action new with

$project = $this->userInput->getProject();
$this->view->assign('project', $project);

<f:debug>{project}<f:debug> shows the complete object with the tags prototype, proxy and persistable. So I suppose this works...

but the form is not filled out with the stuff from project.

    <f:form controller="mycontroller" action="create" class="form-horizontal" objectName="project" method="POST" enctype="multipart/form-data" additionalAttributes="{role:'form', novalidate:'true'}">

which is strange, because in the edit action I am doing the same and it works there..

$this->view->assign('project', $project);

The only difference there is, that the object comes via the repository from the database.

Any idea?


Solution

  • Well, i answer my own question... I had to put the object attribute object="{project}" to the form like this:

    <f:form action="update" objectName="project" object="{project}" class="form-horizontal" enctype="multipart/form-data" additionalAttributes="{role:'form', novalidate:'true'}">