I would suggest that you not create readio buttons using HTML::Template, and that you
use the standard CGI.pm module instead. You will save yourself an ENORMOUS amount of
work.
Here's how simple it is to create a form with group of radio buttons with a checked
value:
#!/usr/bin/perl -wT
use strict;
use CGI;
my $q=CGI->new();
my $default=$q->param('poo');
my $form=$q->start_form();
$form=radio_group(-name=>'poo',-values=>['value1','value2','value3'],
-default=>$default);
$form.=$q->submit;
$form.=$q->end_form();
print $q->header();
print $form;
#$form can also plugged into an HTML::Template TMPL_VAR, if you wanted.
#I usually create all my forms embedded in a table with CGI, and then
#put this whole shmear into one TMPL_VAR
#######
As is, this script will create a form with a radio group and a default value that is
dependent on what the user has selected. By passing radio_group an array reference for
it's values, you can programmatically create your radio group and use a scalar to set
the default value. I really can't imagine an easier way to do it.
Good luck!
-DJCP
Peggy Redle <[EMAIL PROTECTED]> wrote:
> I need some guidance in dealing with radio buttons.
How do you pass in values? How can you set the checked attribute based
on that value? How do I get the value from the chosen option?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]