Reputation: 458
if I submit my New Action and the form is not valid, then I can't get the submited post vars. $this->request->getArguments() is empty at my new action.
/**
* action new
*
* @param \Vendor\MyExt\Domain\Model\Protokoll $newProtokoll
* @return void
*/
public function newAction(\Vendor\MyExt\Domain\Model\Protokoll $newProtokoll = null)
{
$this->view->assign('newProtokoll', $newProtokoll);
.....
$arguments = $this->request->getArguments();
echo "<pre>";
print_r($arguments);
echo "</pre>";
....
->empty
Upvotes: 0
Views: 898
Reputation: 65
You should have the newAction
for showing the form and a separate createAction
for validating the data and entering in the database. If the form is not valid, the user is returned to the newAction with the $newProtokoll object containing the entered data.
YOU SHOULD NOT use $this->request->getArguments()
as this is automatically casted if you have it in your method arguments.
In the blog example this is explained very detailed: https://docs.typo3.org/typo3cms/ExtbaseFluidBook/3-BlogExample/11-Alternative-route-creating-a-new-posting.html
Upvotes: 2