Nath, Alok (STSD) wrote:
> Hi,
> I am generating a simple form which generates different textfields and
> scrolling list in different rows. When I display the form what I see is, the
> different textfields and scrolling list are not aligned vertically. I want
> the textfields and scrolling list to start under a particular column.
>
> I am using perl::CGI module to draw the form.
>
> Can anybody let me know how to do it ?
>
>
> sub generate_form{
> print $cgi->startform(-method=>'Get') ;
>
> print $cgi->br(),
> "Field A "
> ,$cgi->scrolling_list(-name=>'field_1',
> -values=>['field_1'],-default=>['field_1']),
> $cgi->br(),
> $cgi->br(),
> "Field B ", $cgi->textfield(-name=>'field_b'),
> $cgi->br(),
> $cgi->br(),
> "Field C ", $cgi->textfield(-name=>'field_c'),
> $cgi->br(),
> $cgi->br(),
> "Field D ", $cgi->textfield(-name=>'field_d'),
> $cgi->br(),
> $cgi->submit(-name=>'button_name', -value=>'Update') ;
>
> print $cgi->endform() ;
> }
You need to put your form into a HTML table. This is a very simple adaptation of
your code to do that. It should give you a start.
HTH,
Rob
sub generate_form{
print $cgi->start_form(-method => 'get') ;
print $cgi->table(
$cgi->Tr([
$cgi->td([
"Field A",
$cgi->scrolling_list(
-name => 'field_1',
-values => [qw/field_1 field_2 field_3 field_4 field_5/],
-default => 'field_1')
]),
$cgi->td(["Field B", $cgi->textfield(-name => 'field_b')]),
$cgi->td(["Field C", $cgi->textfield(-name => 'field_c')]),
$cgi->td(["Field D", $cgi->textfield(-name => 'field_d')]),
])
);
print $cgi->end_form() ;
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>