[Catalyst] How to use HTML::Widget::Constraint::Date

Carl Franks fireartist at gmail.com
Sun Nov 26 19:05:57 GMT 2006


On 26/11/06, Alejandro Imass <alejandro.imass at gmail.com> wrote:
> Thanks!
>
> But how do I use this constraint if I have several date fields in my
> form? Suppose I have two dates which would mean 6 fields on the form
> (per your explanation above). Do I just pass all 6 in order to the
> constraint? or am I missing the point entirely?

You would add 2 constraints - something like:

$form->constraint( Date => 'start_year', 'start_month', 'start_day' );
$form->constraint( Date => 'end_year', 'end_month', 'end_day' );

If your data already has the date in a single field, rather than 3,
create a Callback constraint, and base the code on the check in
HTML/Widget/Constraint/Date.pm

Carl



More information about the Catalyst mailing list