[Flow] form validation: arguments getting lost in some cases
Andre Hohmann
mail at andre-hohmann.net
Thu Jun 11 08:25:11 CEST 2015
Good morning,
my problem is, that arguments of a form sometimes getting lost after
submitting. I work with a form to create an object. I want to validate
before "creation of the object" (persistance in database), if several
conditions are true or false. Therefore in my controller the
createAktion looks like that:
/**
* @param ItoopAtcDomainModelMitglied $newMitglied
* @return void
* @FlowValidationGroups({"default"})
* @ItoopAtcAnnotationsLogNewMitglied
*
*
*
*
*/
public function createAction(Mitglied $newMitglied) {
...
...
// if abteilung is breitensport don't allow beitragssatz ehepaar
if ($ABT === 'Breitensport' and $BS === 'Ehepaar') {
$this->flashMessageContainer->addMessage(new TYPO3FlowErrorError(
'In der Abteilung Breitensport gibt es keine Beitragsklasse für
Ehepaare. Entweder die Abteilung ändern oder einen anderen Beitragssatz
wählen.'));
// forward back to originating request
$this->errorAction()->forwardToReferringRequest();
}
...
$this->mitgliedRepository->add($newMitglied);
$this->addFlashMessage('Neues Mitglied erfolgreich angelegt.');
$this->redirect('index');
}
When the user of my App fills in fields validated by the "conventional"
validation (@FlowValidationGroups({"default"})) "incorrectly",
everything works fine, so the user is getting back to the form and the
fields are still filled. But when the user fills in the fields so that
the condition in my controller above is true, he is getting back to the
form, but the fields now are emtpy! So I think, the arguments are
getting lost after/by executing
"errorAction()->forwardToReferringRequest();".
In another action (a search form) I have the same problem. But in that
action I validate only by conventional validation.
But with an controller with an editAction on the other hand everything
works fine although I work with
"errorAction()->forwardToReferringRequest();".
Does anybody know why and how to prevent getting arguments lost?
--
Mit freundlichen Grüssen
Andre Hohmann
---------------------------------------------------------------------------------------------
http://www.andre-hohmann.net
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren und die unbefugte Weitergabe dieser E-Mail sind nicht gestattet.
More information about the Flow
mailing list