[Catalyst] C::C::FormBuilder - Forwarding to another action
overwrites data from the calling action
Juan Camacho
jc5826 at gmail.com
Thu Feb 15 00:43:15 GMT 2007
OK, I've made a small change to the C-C-FormBuilder-Action class that
should now help get you on your way. Instead of [% FormBuilder.render
%], you'll need to use [% forms.foo.FormBuilder.render %]. BTW, try
to make the the stash name 'forms' configurable. I look forward to
seeing a final version of MultiForm.
Index: lib/Catalyst/Controller/FormBuilder/Action.pm
===================================================================
--- lib/Catalyst/Controller/FormBuilder/Action.pm (revision 6038)
+++ lib/Catalyst/Controller/FormBuilder/Action.pm (working copy)
@@ -133,6 +133,7 @@
my $form = $self->_setup_form(@_);
$controller->_formbuilder($form);
$self->NEXT::execute(@_);
+ $controller->_formbuilder($form); # keep the same form in case
of forwards
$self->setup_template_vars( @_ );
}
Once I'm finished with an additional unit test, I'll release to CPAN.
On 2/14/07, Danny Warren <danny at io.com> wrote:
> Attached is a copy of the MyApp I am using to test this.
>
> Quick explanation of what is what:
>
> lib/MyApp/Controller/Company.pm + Base.pm:
>
> The sample code you provided, with action names renamed for laziness
> (so I could reuse the templates, etc)
>
> lib/MyApp/Controller/Test.pm:
>
> My test app, pointing at the FB::Multiple module (which is not really
> working yet, so I am mainly just using it so I can spit out log msgs)
>
> lib/Catalyst:
>
> The FB::Multiple lib I am using (with debug log msgs)
>
> So you should be able to hit /company/foo or /test/foo and look in the
> logs for the "ACTION" / "REAL ACTION" / "FORM NAME" debug messages.
>
> Also note, I am aware now that my TT files are kinda wrong - I don't
> know why I expected that including a second TT with another [%
> FormBuilder.render %] in it would magically work (I know now that it is
> doing exactly what it should be - rendering two copies of whatever is in
> $self->formbuilder). I just kept them there, since I am looking at the
> logs and not at the page for testing. I planned on adjusting the
> templates once I got the "access by form name" thing working.
>
> Let me know if there is anything else I can do to help!
>
> Thanks,
> Danny
>
More information about the Catalyst
mailing list