[html-formfu] Perl DBI with FormFu

Manu Kaul manu.kaul at gmail.com
Tue Mar 17 11:37:19 GMT 2009


Ok cool. Thanks for the tip. Will check it out.

On Tue, Mar 17, 2009 at 11:31 AM, Carl Franks <fireartist at gmail.com> wrote:

> 2009/3/17 Manu Kaul <manu.kaul at gmail.com>:
> > Hi,
> > I am still trying to get my head around how FormFu works and still
> reading
> > through the documentation to understand what is possible and what is no=
t.
> So
> > bear with me if I am not making sense :)
> > But I want to be able to list out all the validations that are required
> on
> > the form i.e. required fields, checking field lengths, checking field
> values
> > against regular expressions, etc in the Config::General XML file. And
> then
> > use that in my Catalyst project with FormFu.
> > But instead of going   $form->create() or  $form->update... which will
> use
> > FormFu::Model::DBIC I think, I want to be able to pass the form values =
to
> a
> > custom method written in my Model class.
> > Also was wondering how I can then display the DEFAULT values for a form
> when
> > in EDIT mode, when I have a custom Model class in the background.
> > Is it possible for you to provide me some sample code that caters to wh=
at
> I
> > am doing or point me out some sample projects that are using FormFu so I
> can
> > see how the configuration aspects of form validation will work. Then I
> can
> > work on passing these off (once past validation) to my custom Perl DBI
> MODEL
> > class.
> > Hope this is making sense?
>
> Check out HTML::FormFu::Model::HashRef which Moritz has been working on in
> svn
> ( /trunk/HTML-FormFu/ )
>
> I think it'll provide both aspects - filling in the form from your
> model - then providing the submitted values to pass to your model.
>
> I think it would work something like this:
>
>    my $form  =3D $c->stash->{form};
>    my $model =3D $c->model('Foo');
>
>    if ( $form->submitted_and_valid ) {
>        $model->do_something_with_values(
>            $form->model->create,
>        );
>    }
>    elsif ( !$form->submitted ) {
>        $form->model->default_values(
>            $model->get_values,
>        );
>     }
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>



-- =


The greater danger for most of us lies not in setting our aim too high and
falling short; but in setting our aim too low, and achieving our mark.
- Michelangelo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20090317/a9=
939868/attachment.htm


More information about the HTML-FormFu mailing list