[Catalyst] C::C::FormBuilder question

Marc Logghe Marc.Logghe at DEVGEN.com
Wed Jan 31 08:31:08 GMT 2007


> -----Original Message-----
> From: Juan Camacho [mailto:jc5826 at gmail.com] 
> Sent: Tuesday, January 30, 2007 6:22 PM
> To: The elegant MVC web framework
> Subject: Re: [Catalyst] C::C::FormBuilder question
> 
> On 1/29/07, Marc Logghe <Marc.Logghe at devgen.com> wrote:
> > Actually, the docs give a TT example:
> > [% FormBuilder.render %]
> > And therefore in TT it is not clear whether it is a variable or a 
> > package name. Anyways, I tried it with the package name in Mason as 
> > well (FormBuilder->render, 
> Catalyst::Controller::FormBuilder->render, ....):
> > nope. 99% sure in the TT example 'FormBuilder' is a variable, not a 
> > package name.
> > It seems to work only when I do the assignment in the controller:
> > $c->stash->{form} = $self->form;
> >
> > In Mason template:
> > <% $form->render %>
> >
> > No magic...
> 
> by default C-C-FormBuilder does the equivalent of this:
> 
>    $c->stash->{FormBuilder} = CGI::FormBuilder->new(\%attr)
> 
> If instead you want it to be $c->stash->{form} set obj_name 
> config variable:
> 
> obj_name:
>     Not applicable for HTML::Template view. By default, it is 
> FormBuilder. e.g. $c->stash->{FormBuilder} = $formbuilder.

The reason why everything was broken up in my case was because of this:
$c->stash->{template} = '/moe/mol_3D_conv_form';
$c->forward($c->view);

One way or another, when forward() is called the C::C::FB code that sets
the stash and all, is never called.
Also when you do a detach(). When, the forward() line was replaced by a
simple return statement, it worked again.

Not sure whether this is a bug or a feature. I still don't understand
how the calling chain looks like, but my gut feeling is that it must
have to do with that.
Cheers,
Marc




More information about the Catalyst mailing list