[Catalyst] C::C::FormBuilder - Forwarding to another action overwrites data from the calling action

Juan Camacho jc5826 at gmail.com
Wed Feb 14 01:27:28 GMT 2007


On 2/12/07, Danny Warren <danny at io.com> wrote:
> It looks to me that forwarding from one "Form" action to another "Form"
> action causes the FormBuilder data from the first action to be
> overwritten.
>

> Can you confirm this, or am I doing something wrong here?  I am still
> somewhat green with Catalyst, so I might be misunderstanding exactly how
> forwards work.  From reading the docs, I was under the impression that
> two actions should not clobber each other upon forwarding (since
> forwarded actions are processed inside an eval).
>

Each action will have it's own formbuilder object instance. After you
return from the forward to another form action, $self->formbuilder
will be a brand new FormBuilder object.

sub foo : Form('foo') {
   my ($self, $c) = @_;
   # $self->formbuilder is for foo form
   $self->forward('bar');
   # now $self->formbuilder is for bar form
}

sub bar : Form('bar') { ... }

Consequently, each action should do it's own thing with it's
FormBuilder object -- e.g. validate, add or change form fields). Not
sure what kind of problem you are having as a result of this since you
didn't provide sample Controller code.



More information about the Catalyst mailing list