Form::Data::Processor - Yet another form data validator
package MyForm::Field::Address;
use Form::Data::Processor::Moose;
extends 'Form::Data::Processor::Field::Compound';
has_field zip => ( type => 'Text', required => 1 );
has_field addr1 => ( type => 'Text', required => 1 );
has_field addr2 => ( type => 'Text' );
has_field state => ( type => 'Text', required => 1 );
has_field country => ( type => 'Text', required => 1 );
...
package MyForm;
use Form::Data::Processor::Moose;
extends 'Form::Data::Processor::Form';
has_field 'addresses' => ( type => 'Repeatable' );
has_field 'addresses.address' => ( type => '+MyForm::Field::Address' );
has_field 'addresses.type' => (
type => 'List',
required => 1,
options => [ 'BILLING', 'SHIPPING' ],
multiple => 0,
);
...
# later in your controller
my $form = MyForm->new;
die 'Not valid' $unless form->process( $ctx->params );
Yet another form data validator, which is inspired by HTML::FormHandler.
It has similar syntax and similar features, but it is NOT a form generator. Anyway you can extend it as you wish.
I don't like Repeatable field in HFH - it is too slow (as the whole HFH is). But I like its syntax. So FDP should be a little bit faster than HFH.
Please look at benchmarks (benchmarks
folder).
HTML::FormHandler - HTML form validator and generator.
Dmitry "dim0xff" Latin <[email protected]>
This software is copyright (c) 2015 by Dmitry Latin.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.