[html-formfu] Standalone testing with FormFu
Mario Minati
mario.minati at googlemail.com
Mon Sep 24 08:06:39 GMT 2007
On Monday 24 September 2007 06:15:12 Thomas L. Shinnick wrote:
> Still playing with the vertically-aligned example and trying out
> various features, including the validation constraints and error
> messages. But how to test the input error checking without lots of
> code or embedding into another program?
>
> It is possible to feed sample input values into FormFu using the YAML
> config file. At the end of my FormFu .yml I added
>
> query:
> contact_phone: testing
> contact_email: tshinnic at gmail.com
>
> to set the form's 'input' values.
>
> I had tried to use the "process:" key as documented, but because the
> config loading is still going on process() really can't, uh, process
> yet. So to force 'input' processing to test constraints and all, I
> simply added a process() call to the short demo program.
> my $form = HTML::FormFu->new;
> $form->load_config_file('uw1.yml');
> $form->process;
>
> my $tt = Template->new;
> $tt->process(
> 'uw1.tt',
> { form => $form },
> 'uw1.html',
> ) || die $tt->error;
>
> I can feed bad values in, or leave some required values missing, and
> generally try out lots of combinations of errors, all without much
> coding. Just being lazy...
Why don't you just call $form->render after calling process?
Greets,
Mario
More information about the HTML-FormFu
mailing list