[TYPO3-mvc] Extra validation in create and redirect back to new

Henrik Møller Rasmussen info at hmrdesign.dk
Sun Nov 14 19:14:28 CET 2010


Hello,

I have a new-form for a domain model Person (firstname, lastname etc.) 
This works perfect with validation and saving into repository. I have 
now added a field to the new form, which is not part of the domain 
model. I want to do some validation of this field before saving to 
repository, and redirect back to new-action if the validation fails.

I have tried doing this as the first thing in create:

...
if(EXPRESSION) {
	$this->redirect('new',null,null,array('person'=>$person));
} else {
  // save into repos.
}
...


This however gives rise to some extbase exceptions saying the object is 
not persisted (it shouldn't be at this time). I have also tried using 
forward(), but then the $person object is null.

I hope it is clear what I am trying to do -- otherwise let me know and 
I'll explain it differently.

Any help is appreciated - thanks.

Best regards

Henrik


More information about the TYPO3-project-typo3v4mvc mailing list