[html-formfu] Displaying 2 forms in the same page

Andreas Marienborg omega at palle.net
Thu Oct 9 21:19:01 BST 2008


On Oct 5, 2008, at 6:01 PM, Octavian Rasnita wrote:

> Hi,
>
>   I am working on a Catalyst app, and I need to display a login form  
> in every
>   page, (which could be shown or it could be replaced with a  
> "logout" button
>   or link).
>   In some pages I also need to display a second form and if I use the
>   parameter FormConfig for loading it, the content of this form is  
> shown in 2
>   places.
>
>   What's the suggested way of handling this problem?
>   Should I create the login form manually in every page using $c- 
> >form?
>
>   Thank you for any hints.
>
>

Some suiteable place:

package MyApp::Controller::Root;

use parent 'Catalyst::Controller::HTML::FormFu';

sub auto : Private {
   my ($self, $c) = @_;

my $login_form = $self->form;
$login_form->load_config('forms/login.yml');

$c->stash->{login_form} = $login_form;
}

Then you wont stomp on your own form all the time.


- andreas





More information about the HTML-FormFu mailing list