[Catalyst] Invoke *complete* subrequests in Catalyst?
Nate Wiger
nwiger at scea.com
Wed Sep 20 00:01:55 CEST 2006
Matt S Trout wrote:
> Nate Wiger wrote:
>> I'm building an AJAX app with FormBuilder, and want to use it to embed
>> multiple forms in a page (each of which would be linked to a different
>> action and submitted using JQuery). I've found I can do this, but I've
>> had to make changes to the FB plugin so that it only instantiates an
>> object on a call to $c->form, and doesn't use prepare() to do so. This
>> then requires a bit of internal magic to work both normally and in
>> subrequest mode.
>>
>> Other ideas?
>
> Actually, yes.
>
> MAKE IT A CONTROLLER BASE CLASS LIKE I ALREADY SAID
>
> You just proved *perfectly* why this is a really stupid thing to have as a
> plugin ...
Never said I wasn't going to do that... but it doesn't really solve the
problem. I've played with the base class, AFAICT it has the issue that
you have to say something like this:
sub myform : Local Form {
my($self,$c) = @_;
my $form = $c->form;
$form->etc(...);
$c->stash->{form_output} = $form->render;
}
To get the form instantiated and rendered. In the normal case, having it
as a plugin makes sense because:
- The form config is automatically resolved per the $c->action
- The form is loaded during Catalyst preparation
- The form is rendered automatically via Catalyst View::Whatever
I'm not sure if you've actually tried to use the FormBuilder plugin or
not. If you can show/hint/link at how these items could be done via a
base class, and auto-invoked during prepare(), that would be helpful. So
far I can't find any decent documentation on controller base classes.
-Nate
More information about the Catalyst
mailing list