You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Kenneth Lee <kl...@hknet.com> on 2000/07/18 11:45:21 UTC
[OT] New element for CGI.pm (or StickyForms, etc.)
Hi all,
anyone thought of a 'date_field' element for CGI.pm (or StickyForms, etc.)?
this is my thought,
use CGI qw/:standard/;
print date_field(
-name =>"expiry",
-year =>2000,
-month=>12,
-day =>25);
$expiry_date = param('expiry');
which is an elegant way to do
use CGI qw/:standard/;
print textfield(-name=>'expiry_year', -value=>2000);
print popup_menu(-name=>'expiry_month', -values=>[1..12], -default=>12);
print popup_menu(-name=>'expiry_day', -values=>[1..31], -default=>25);
$expiry_date = sprintf "%d-%d-%d", param('expiry_year'),
param('expiry_month'), param('expiry_day');
and the date validation can be done in query string parsing too.
Thanks for any input.
Kenneth