Better still,
print date_field(
-name =>"expiry",
-value=>"2000-12-25");
so that if value is omitted, the current value will be used.
But date format will be a great concern.
And how about time_field() also?
Sorry for the annoyance.
-------- Original Message --------
Subject: [OT] New element for CGI.pm (or StickyForms, etc.)
Date: Tue, 18 Jul 2000 17:45:21 +0800
From: Kenneth Lee <[EMAIL PROTECTED]>
To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
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