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

Henrik Møller Rasmussen info at hmrdesign.dk
Tue Nov 16 10:34:42 CET 2010


Hello again,

I found the right solution I think :)

Added the argument to the createAction and added a custom @validate for 
the argument to the createAction.

Extbase and fluid just keep getting better the more you use it :)

- Henrik



On 14/11/10 19.14, Henrik Møller Rasmussen wrote:
> 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