This is a two-column table with a label in the left-hand column and form elements in the right-hand column. I am trying to get the radio buttons for the chair color all in the second column. But they keep ending up in the first column.
Here is the relevant piece of code:
use HTML::Template;
use CGI qw(:standard);
my $form = '';
$form .= start_form .
table ({-width=>'100%'},
Tr([
td (b ('Chair color:')),
td (radio_group(-name => 'certificate_type',
-values=>['blue','white','green'],)),
td ([b ('Username:'), $ENV{REMOTE_USER}]),
td ([b ('Full name:'), $PARAMS{CURRENT_FULLNAME}]),
td ([b ('Email:'), $PARAMS{EMAIL}]),
])) . submit('Submit') . reset . end_form;
(Even better would be to get the buttons in the second column but stacked vertically.)
I presume you want “Chair colour” in the first column, to the left of the three radio buttons in the second column?
The problem is that you have put “Chair Colour” and
radio_groupin two separatetdelements, so they will appear on separate rows.You need to pass them together, enclosed in an anonymous array, to a single
tdcall, as you have the last three rows.Also, a parameter of
-columns => 1to theradio_groupwill force them into a single column.This code seems to do what you need.