Teresa

I seem to remember such an enquiry a couple of weeks ago in this group. The
answer I saw, and I believe to be correct, is that, if a CGI param has not
been given a value, its name will not appear in $q->param(). You therefore
need a local list of CGI param names in order to check whether they are
expected, but have not been given a value.

Regards
- Roger -

----- Original Message -----
From: "Teresa Raymond" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 25, 2001 2:02 PM
Subject: How to ck for null set w/ Checkboxes


> How do you check for the null set or blank with checkboxes using
> CGI.pm?  The following code does not work for checkboxes though it
> does for all other input fields.
>
> #TEST FOR BAD CHARS
> my ($name, $value);
>
> foreach $name ($q->param())
> {foreach $value ($q->param( $name ))
>   {#CK FOR BLANKS
>    if ($value eq "" || $value eq " ")
>    {print <<"PrintTag";
> <html>
> <head>
> <STYLE type="text/css">
> <!--
> BODY {
> background-color: #ffffcc;
> font-size: 12pt;
> color: #000066;
> text-align: center
> }
> H1 {
> font-size: 14pt
> }
> -->
> </STYLE>
> <title>Alert!</title>
> </head>
> <body bgcolor="#ffffcc" color="#000066">
> <center>
> <h3>Alert!</h3>
> <p>All fields are required.<br>Please push the back button on your
> browser and try again.
> </p>
> </body>
> </html>
> PrintTag
>    exit(0);
>    }
> }
>
>
> -------------------------------
> -  Teresa Raymond             -
> -  [EMAIL PROTECTED]   -
> -  http://www.mariposanet.com -
> -------------------------------
>
> --
> 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]

Reply via email to