Clearing radio_group

From: Nerfherder (nobody_at_home.com)
Date: 12/15/04


Date: Tue, 14 Dec 2004 23:32:47 GMT

I would like to be able to deselect a radio_group when the user selects
to clear the form.

#!/usr/local/bin/perl

use CGI qw(:standard);
$query = new CGI;

my $policy = "blank";

if( param( 'action' )) {
    if( param( 'action' ) eq "Clear" ) {
        $policy = "blank";
    }
}

print header(), start_html(), start_form();

print radio_group( -NAME=>'level',
                   -VALUES=>[ 'Personal', 'Complete' ],
                   -LINEBREAK=>'true',
                   -DEFAULT=>$policy );

print br, $policy, br;

print br, submit( -NAME=>'action',
                  -VALUE=>'Clear' ), " ";

print end_form(), end_html();



Relevant Pages

  • Re: Form Data to File
    ... use CGI ':standard'; ... my $query = new CGI; ... #use strict I'm not using this because I get errors at the command ... perldoc perlintro ...
    (perl.beginners)
  • Re: Simplest way (or module) to tweak query in CGI server-side validation
    ... automatically carried through by CGI. ... I have to read in the query, ... change as desired, then append it to the redirect URL, starting with ... I believe that this GET request will serve my ...
    (comp.lang.perl.misc)
  • Re: CGI advice
    ... and results in a table of links from the query results. ... should I go XML to HTML (via some ... If this is the start to a large application suite you would be silly not to, if it is a few one off CGI scripts then there is not likely any need, if it is somewhere in between I say hack it up and see how far you get, then refactor if the need presents itself. ... Whether you use its HTML generation abilities is more a matter of preference, personally I don't, but then I also use a home grown templating system which I already told you not to do :-). ...
    (perl.beginners)
  • Re: Simplest way (or module) to tweak query in CGI server-side validation
    ... I have to read in the query, ... You can direct the user's web-browser to submit to another CGI via GET by ... browser in order to do this with a POST rather than than a GET. ... If the place you are redirecting too will accept a GET instead of a POST, ...
    (comp.lang.perl.misc)
  • incorrect identifier error with Oracle
    ... I'm using the Perl DBI to access a Oracle 9i db using a form generated ... I know the CGI is parsing the query from the textarea input properly ...
    (perl.dbi.users)