[html-formfu] Standalone testing with FormFu
Thomas L. Shinnick
tshinnic at io.com
Mon Sep 24 05:15:12 GMT 2007
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...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20070923/ebeebac1/attachment.htm
More information about the HTML-FormFu
mailing list