Added options to turn off the date on the date method and to add extra info to the form table.

This commit is contained in:
JT Smith 2002-08-22 05:02:16 +00:00
parent 78d7b27e03
commit bf9fdd53f1

View file

@ -292,7 +292,7 @@ sub combo {
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 date ( name [ label, value, extras, subtext, size ] ) =head2 date ( name [ label, value, extras, subtext, size, noDate ] )
Adds a date row to this form. Adds a date row to this form.
@ -326,10 +326,15 @@ sub combo {
The number of characters wide this form element should be. There The number of characters wide this form element should be. There
should be no reason for anyone to specify this. should be no reason for anyone to specify this.
=item noDate
By default a date is placed in the "value" field. Set this to "1"
to turn off the default date.
=cut =cut
sub date { sub date {
my ($subtext, $class, $output, $name, $label, $extras, $size, $value); my ($subtext, $noDate, $class, $output, $name, $label, $extras, $size, $value);
$class = shift; $class = shift;
$name = shift; $name = shift;
$label = shift; $label = shift;
@ -338,6 +343,8 @@ sub date {
$extras = shift; $extras = shift;
$subtext = shift; $subtext = shift;
$size = shift || 10; $size = shift || 10;
$noDate = shift;
$value = "" if ($noDate);
$output = '<input type="text" name="'.$name.'" value="'.$value.'" size="'. $output = '<input type="text" name="'.$name.'" value="'.$value.'" size="'.
$size.'" maxlength="10" '.$extras.'>'; $size.'" maxlength="10" '.$extras.'>';
$output .= '<input type="button" style="font-size: 8pt;" onClick="window.dateField = this.form.'. $output .= '<input type="button" style="font-size: 8pt;" onClick="window.dateField = this.form.'.
@ -823,7 +830,7 @@ sub interval {
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 new ( [ noTable, action, method, extras, enctype ] ) =head2 new ( [ noTable, action, method, extras, enctype, tableExtras ] )
Constructor. Constructor.
@ -855,18 +862,28 @@ sub interval {
The ecapsulation type for this form. This defaults to The ecapsulation type for this form. This defaults to
"multipart/form-data" and should probably never be changed. "multipart/form-data" and should probably never be changed.
=item tableExtras
If you want to add anything special to the form's table like
a name or stylesheet information, you'd add it in here as
follows:
'name="myForm" class="formTable"'
=cut =cut
sub new { sub new {
my ($header, $footer, $noTable, $enctype, $class, $method, $action, $extras); my ($tableExtras, $header, $footer, $noTable, $enctype, $class, $method, $action, $extras);
$class = shift; $class = shift;
$noTable = shift || 0; $noTable = shift || 0;
$action = shift || WebGUI::URL::page(); $action = shift || WebGUI::URL::page();
$method = shift || "POST"; $method = shift || "POST";
$extras = shift; $extras = shift;
$enctype = shift || "multipart/form-data"; $enctype = shift || "multipart/form-data";
$tableExtras = shift;
$header = '<form action="'.$action.'" enctype="'.$enctype.'" method="'.$method.'" '.$extras.'>'; $header = '<form action="'.$action.'" enctype="'.$enctype.'" method="'.$method.'" '.$extras.'>';
$header .= '<table>' unless ($noTable); $header .= '<table '.$tableExtras.'>' unless ($noTable);
$footer = '</table>' unless ($noTable); $footer = '</table>' unless ($noTable);
$footer .= '</form>'; $footer .= '</form>';
bless {_noTable => $noTable, _header => $header, _footer => $footer, _data => ''}, $class; bless {_noTable => $noTable, _header => $header, _footer => $footer, _data => ''}, $class;