|
List Info
Thread: C::C::FormBuilder question
|
|
| C::C::FormBuilder question |

|
2007-01-29 11:02:08 |
|
| 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.
Regards,
Marc
|
| Re: C::C::FormBuilder question |

|
2007-01-29 11:07:00 |
Marc Logghe wrote:
> Couldn't render component
"/moe/mol_3D_conv_form" - error was "Can't
> call method "render" on an undefined value
...
According to the docs, you need to call render on the
package:
<% FormBuilder->render %>
--
package JAPH;use Catalyst
qw/-Debug/;($;=JAPH)->config(name => do {
$,.=reverse qw[Jonathan tsu rehton lre rekca
Rockway][$_].[split //,
";$;"]->[$_].q; ;for
1..4;$,=~s;^.;;;$,});$;->setup;
_______________________________________________
List: Catalyst lists.rawmode.org
Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalyst lists.rawmode.org/
Dev site: http://dev.catalyst.per
l.org/
|
|
| Re: C::C::FormBuilder question |

|
2007-01-30 02:48:57 |
On 29/01/07, Marc Logghe <Marc.Logghe 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-> 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
_______________________________________________
List: Catalyst lists.rawmode.org
Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalyst lists.rawmode.org/
Dev site: http://dev.catalyst.per
l.org/
|
|
| Re: C::C::FormBuilder question |

|
2007-01-30 03:07:19 |
> 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.
Yeah, I stumbled across this the other day but was unsure if
it was
done on purpose (for a controller-specific configuration
rather than a
global config). Nevertheless I found it awkward and IMHO it
should be changed.
--Tobias
_______________________________________________
List: Catalyst lists.rawmode.org
Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalyst lists.rawmode.org/
Dev site: http://dev.catalyst.per
l.org/
|
|
| Re: C::C::FormBuilder question |

|
2007-01-30 10:42:14 |
On 1/30/07, Tobias Kremer <list funkreich.de> wrote:
> > 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.
>
> Yeah, I stumbled across this the other day but was
unsure if it was
> done on purpose (for a controller-specific
configuration rather than a
> global config). Nevertheless I found it awkward and
IMHO it should be changed.
>
> --Tobias
It was done somewhat on purpose since configuring it via
the
controller was how I use it. I would be happy to accept a
patch to
make it read from both places. Just make sure existing
tests continue
to pass and work off the version that's up on subversion at
http://dev.catalyst.perl.org/r
epos/Catalyst/trunk/Catalyst-Controller-FormBuilder/
_______________________________________________
List: Catalyst lists.rawmode.org
Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalyst lists.rawmode.org/
Dev site: http://dev.catalyst.per
l.org/
|
|
| Re: C::C::FormBuilder question |

|
2007-01-30 11:05:57 |
On 30 Jan 2007, at 09:07, Tobias Kremer wrote:
>> 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.
>
> Yeah, I stumbled across this the other day but was
unsure if it was
> done on purpose (for a controller-specific
configuration rather than a
> global config). Nevertheless I found it awkward and
IMHO it should
> be changed.
Why can't you just use a common base class for any
controllers that
need the same defaults?
--
Matt S Trout, Technical Director, Shadowcat Systems Ltd.
Offering custom development, consultancy and support
contracts for
Catalyst,
DBIx::Class and BAST. Contact mst (at)
shadowcatsystems.co.uk for
details.
+ Help us build a better perl ORM: http://dbix-
class.shadowcatsystems.co.uk/ +
_______________________________________________
List: Catalyst lists.rawmode.org
Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalyst lists.rawmode.org/
Dev site: http://dev.catalyst.per
l.org/
|
|
| Re: C::C::FormBuilder question |

|
2007-01-30 11:04:59 |
On 30 Jan 2007, at 08:48, Carl Franks wrote:
> 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.
That's what it's supposed to do! This is a feature, not a
bug - and
the fact that all the plugin-style ones (HW, DFV etc.) use
global
config if frankly a bug in *them* since it makes code re-use
much
harder.
If you need common defaults, use a controller base class.
Works
beautifully.
--
Matt S Trout, Technical Director, Shadowcat Systems Ltd.
Offering custom development, consultancy and support
contracts for
Catalyst,
DBIx::Class and BAST. Contact mst (at)
shadowcatsystems.co.uk for
details.
+ Help us build a better perl ORM: http://dbix-
class.shadowcatsystems.co.uk/ +
_______________________________________________
List: Catalyst lists.rawmode.org
Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalyst lists.rawmode.org/
Dev site: http://dev.catalyst.per
l.org/
|
|
[1-7]
|
|