Zum Inhalt springen

Controller submit Variable nicht exsistent

Erstellt am 2. Oktober 2017 · 3 Antworten · letzte Antwort am 9. Oktober 2017

Tags: Frage

Power-Poler ·

Guten Tag
Hänge an einem sehr nervigen Problem.
Und zwar versuche ich ein Form Element auf meiner Website auszulesen:

<f:form method="post" object='{newEntry}' name='newEntry' action='submitForm' controller='Show'>
<f:form.textfield size="53" property='title'/>
<f:form.textarea rows="4" cols="40" property='bodytext'/>
<f:form.submit class="submit" value="Submit" />
</f:form>
	/**
 * action submitForm
 *
 * @param MyVendor\Bulletinboard\Domain\Model\Entry $newEntry
 * @return void
 */
	public function submitFormAction(MyVendor\Bulletinboard\Domain\Model\Entry $newEntry = NULL) {
	
		if ($newEntry == NULL){
			$newEntry = GeneralUtility::makeInstance('MyVendor\Bulletinboard\Domain\Model\Entry');	
		}
		var_Dump($newEntry);
    }
}

Doch newEntry bleibt Leer. Egal was ich mache. Sobalt ich das "= NULL" rausnehme, bekomme ich folgende Fehlermeldung:
Oops, an error occurred!

Too few arguments to function MyVendor\Bulletinboard\Controller\ShowController::submitFormAction(), 0 passed and exactly 1 expected

Ich hoffe ihr könnt mir da noch helfen, ich stehe gerade völlig auf dem Schlauch.
Danke Schonmal
Mfg
Power-Poler

Edit:
Typo3 7.6.22

Power-Poler ·

Habs jetzt hinbekommen. Habe die Methode von submitFormAction in createAction umbenannt...
Die einziege Frage die sich mir noch stellt:
Warum?

Pingbeat ·

Hast du eventuell vergessen die Action der Pluginkonfiguration hinzuzufügen? create könnte dort schon drinn gewesen sein.

Schau dir mal die ext_localconf.php an und schau welche actions du dort eingetragen hast.

Power-Poler ·

Die Action wurde gefunden, sie befand sich in der localconf.
$newEntry
Wurde nicht übergeben. bis ich die Action in create umbenannt habe.