[Catalyst] C::C::FormBuilder question
Carl Franks
fireartist at gmail.com
Tue Jan 30 08:48:57 GMT 2007
On 29/01/07, Marc Logghe <Marc.Logghe at devgen.com> wrote:
>
>
> Hi all,
> I am lost.
> In my conf I have:
> # configuration of FormBuilder
> Controller::FormBuilder:
> method_name: form
> template_type: Mason
> stash_name: form
> obj_name: fb
> form_suffix: fb
> attr_name: Form
> form_path: __path_to(forms)__
>
> In the mason template:
> <% $form->render %>
> <%args>
> $form => undef
> </%args>
>
> The error I get:
> Couldn't render component "/moe/mol_3D_conv_form" - error was "Can't call
> method "render" on an undefined value ...
> I was convinced that C::C::FormBuilder automagically sets
> $c->stash->{<stash_name>}, but it seems not to be the case (btw: calling
> $c->stash->{form} gives the same error).
> Do you have to assign your fb object manually in the controller ? And if so,
> what is the purpose of the 'stash_name' conf setting ??
> I am afraid I am missing something teriibly.
I was just looking at this last week, as I was using the code as a
basis for a new controller. I suspect that it's never been tested,
because as far as I can tell, it incorrectly reads the config from the
controller object, rather than the application object.
in sub "new",
$self->__setup();
should be
$self->__setup($c);
and in sub "__setup",
my $self = shift;
my $config = $self->config->{'Controller::FormBuilder'} || {};
should be:
my ( $self, $c ) = @_;
my $config = $c->config->{'Controller::FormBuilder'} || {};
Cheers,
Carl
More information about the Catalyst
mailing list