NAME

HTML::Controls::Date - class for a date control

SYNOPSIS

my $date = HTML::Controls::Date->new('name');

This class implements a control for entering dates. At the moment it uses three input fields, and Date::Parse for the validation.

VALUE FORMAT

The internal representation of a date is a hash reference, with three keys:

y

for the year

m

for the month

d

for the day

So you should do:

$date->setData({y=>2005,m=>9,d=>21});

and expect getData to return such a hash reference.

REDEFINED PUBLIC METHODS

setDataFromPost

Since this control uses three fields, this method had to be redefined. It uses "_get_fields" to access the POSTed values, and "_pack_date" to make the hash.

REDEFINED PROTECTED METHODS

_body_template_name

Returns 'date.wt'.

_body_template_parms

Calls the inherited method, then adds to the hash the three values, with keys year, month, day.

_validate_value

Calls the inherited method, then calls "_unpack_date" to get the current three values, and passes them to str2time to check their validity.

ADDITIONAL METHODS

_unpack_date

Given a date in internal representation, returns a list with year, month, day.

_unpack_date

Given a list with year, month, day, returns a date in internal representation.

_get_fields

Given a base name (i.e. the control's name) and a request object, returns a list with year, month, day values.

NOTE: this has to be kept in sync with the names generated by the template.

COPYRIGHT

Copyright 2005 Gianni Ceccarelli, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.