[Catalyst] C::C::FormBuilder - Forwarding to another
action overwrites data from the calling action
Danny Warren
danny at io.com
Wed Feb 14 19:46:31 GMT 2007
Yep, that sequence of events is exactly what I am seeing. Hooray, I am
not crazy! (well, on this one thing...)
One way I was thinking of getting around this was to do the same thing
you suggested with the template vars for the $controller->_formbuilder
data - create named aliases (at step 1 and 1a below) so that the CGI::FB
object can be grabbed even if clobbered by the forward. I will try this
out while you are checking in to things yourself (I haven't done it yet
because it doesn't look clean to implement, and I thought I was doing
something really wrong).
What I guess we would end up with is an FB::Multiple module that:
1) Still provide the normal ways of getting at form data, so that your
actions with no forwards still work like normal (ex: [%
FormBuilder.render %] and $self->formbuilder)
2) Provide an alternate way of getting at form stuff, so that you can
get data even if you are using forwards (ex: [%
forms.foo.FormBuilder.render %] and $self->forms{foo} or
$self->forms_foo - still haven't decided on a naming scheme)
Will send you my test app in a moment.
Thanks again!
Danny
Juan Camacho wrote:
> Doubt it has anything to do with your environment. I thought I had
> tested it a while back when helping someone else, but maybe something
> was overlooked since I never got a final word back from the guy I was
> helping. I think I have an idea of what might be wrong -- it has to
> do with the following sequence of events:
>
> Action foo
> ========
> 1) setup new FormBuilder before action
> 2) Run foo action which then $c->forwards to foo_search
> Action foo_search
> ==============
> 1a) setup new FormBuilder before action
> 1b) run foo_search action
> 1c) setup_template_vars for foo_search after action
> 3) setup_template_vars for foo after action
>
> Problem in #3 is that $self->_formbuilder is clobbered from the inner
> forward action.
>
> I will try to look into this today and get back to you, but it may not
> be until quite late tonight and I won't be able to spend too much time
> on it until this weekend. In the mean time, send *me* directly a
> zip/gz of a minimal MyApp catalyst application (including forms and tt
> files) so I can quickly get going on it.
>
> Hopefully others will chime in to provide other ideas and
> clarification of the action sequence.
More information about the Catalyst
mailing list