From: "Steve Rippl" <rip...@woodlandschools.org>

Hi,

I'm using Catalyst and FormFu, and I've found I can vary the config file used with

sub controller_name :Local :Formconfig('/path/to/file.yml')

Can I set that file name using a variable, essentially off one of the url args, so that I could use a different file depending on the variable passed? I'd like to parse different files under different conditions but not build all new controllers for each case.

Thanks, and seasons greetings!


Hi,

You can use something like this:

package MyApp::Controller::Test;
use base 'Catalyst::Controller::HTML::FormFu';

sub action : Local {
 my ($self, $c, $template) = @_;

 my $form = $self->form;
 $form->load_config_filestem($template);
 $form->process;
 $c->stash(form => $form);
}

And you could access it at an URL like:

http://www.site.com/test/action/user

It will display the form user.yaml (or user.conf).

Octavian


_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to