Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Creating HTML radio button group with text field

by impossiblerobot (Deacon)
on May 05, 2002 at 15:07 UTC ( [id://164137]=note: print w/replies, xml ) Need Help??


in reply to Creating HTML radio button group with text field

Here was my CGI.pm solution (with less relevant details stripped out):
my @values = qw( a b c d ); my %labels = ( a => 'Friend', b => 'Magazine (please specify:)', c => 'Internet', d => 'Other', ); $labels{$_} = $cgi->escapeHTML($labels{$_}) for keys %labels; $labels{b} .= $cgi->textfield(-name => 'magname'); print $cgi->start_form(); $cgi->autoEscape(0); print $cgi->radio_group(-name => 'question', -values => \@values, -linebreak => 'true', -labels => \%labels); $cgi->autoEscape(1); print $cgi->endform;
I didn't like having to turn off autoEscape() and explicitly escape the other entries, so I was looking for a cleaner solution -- but it looks like that's as good as it gets (with CGI.pm, at least).

Thanks jeffa, podmaster.

Impossible Robot

Replies are listed 'Best First'.
Re^2: Creating HTML radio button group with text field
by Anonymous Monk on Sep 09, 2009 at 19:39 UTC

    This works for me however the only problem I get now is that whenever I click in the textfield, the focus always returns to the actual radiobutton so I can't actually type in the textfield

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://164137]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2024-09-07 18:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.