[sf-perl] Those darn check boxes ...

Neil Heller nheller at silcon.com
Thu Jun 5 12:23:34 PDT 2008


I notice a lot of duplication in your object descriptions.
Might it be advantageous to just pass the unique portions to a subroutine?

Neil Heller


-----Original Message-----
From: sanfrancisco-pm-bounces+nheller=silcon.com at pm.org
[mailto:sanfrancisco-pm-bounces+nheller=silcon.com at pm.org] On Behalf Of ken
uhl
Sent: Thursday, June 05, 2008 12:17 PM
To: sanfrancisco-pm at pm.org
Subject: [sf-perl] Those darn check boxes ...


Thanks all who chimed in, Garth, Tom, Mike :

To respond to all your clarifying questions, and my progress so far:

I am using hidden fields in HTML  to pass check boxes to a different 
script,  thusly:

<INPUT TYPE=hidden NAME="tagbucket"          
value="bulkdeleteHost-type-CNAME-row-30585">
  <INPUT TYPE=hidden NAME="tagbucket"          
value="bulkdeleteHost-type-A-row-270902">
  <INPUT TYPE=hidden NAME="tagbucket"          
value="bulkdeleteHost-type-A-row-270903">
  <INPUT TYPE=hidden NAME="tagbucket"          
value="bulkdeleteHost-type-A-row-270901">
  <INPUT TYPE=hidden NAME="tagbucket"          
value="bulkdeleteHost-type-CNAME-row-30583">
  <INPUT TYPE=hidden NAME="tagbucket"          
value="bulkdeleteHost-type-A-row-270898">
  <INPUT TYPE=hidden NAME="tagbucket"          
value="bulkdeleteHost-type-TXT-row-6799">

This way I retrieve all the check box field names, regardless of whether 
they are checked or not.

if I simply pass the hidden fields as
<INPUT TYPE=hidden NAME="tagbucket"   >

I get zippo - no check box names, no value pairs. I guess there is a 
different path I should be on....

Ken Uhl



sanfrancisco-pm-request at pm.org wrote:
( snipped intervening text )

>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 04 Jun 2008 13:43:36 -0700
> From: ken uhl <kenuhl at berkeley.edu>
> Subject: [sf-perl] passing checkboxes as hidden fields
> To: sanfrancisco-pm at pm.org
> Message-ID: <4846FE78.3080708 at berkeley.edu>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hi,
> I have a question on how to determine the value of a checkbox ( checked 
> or unchecked ) when
> passing check boxes as hidden fields to a separate cgi.
>
> The checkboxes are all all the named 'tagbucket'
> with different values, 
> so I retrieve those this way
>
> use CGI;
> my $cgi = new CGI;
>
> my @boxes  = $cgi->param('tagbucket');
>
> This gives me a nice array of check box field names, but I don't know if 
> they are selected,
>
> so I try retrieving each box :
>
> for my $box ( @boxes ) {
>     my $box_data = $cgi->param($box);
>     };
>
> This give me nothing.
>
> By the way the check box is defined this way :
>
>   my $cb_name =  "bulkdeleteHost-type-$htype-row-$hrowid" ;
>   my $be_bad =  $cgi->checkbox( -name => "tagbucket"  , -checked => 0, 
> -value => "$cb_name"  , -label => "Bulk Delete?") ;
>
> Any suggestions ? 
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 4 Jun 2008 14:16:21 -0700
> From: "Garth Webb" <garth.webb at gmail.com>
> Subject: Re: [sf-perl] passing checkboxes as hidden fields
> To: "San Francisco Perl Mongers User Group" <sanfrancisco-pm at pm.org>
> Message-ID:
> 	<c0d982e10806041416n6ce3265em82be31b391c0fcdb at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> If a checkbox is unchecked, the browser will send nothing to you.  Only if
> the box is checked will you get a name=value pair.
>
> On Wed, Jun 4, 2008 at 1:43 PM, ken uhl <kenuhl at berkeley.edu> wrote:
>
>   
snip
> ------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20080604/23346ec2/a
ttachment-0001.html 
>
> ------------------------------
>
> Message: 3
> Date: Wed, 4 Jun 2008 14:24:55 -0700 (PDT)
> From: Thomas Brightbill <thomas at brightbill.net>
> Subject: Re: [sf-perl] passing checkboxes as hidden fields
> To: San Francisco Perl Mongers User Group <sanfrancisco-pm at pm.org>
> Message-ID: <Pine.LNX.4.58.0806041417040.24383 at bolt.sonic.net>
> Content-Type: TEXT/PLAIN; charset=US-ASCII
>
>   
snip
> On Wed, 4 Jun 2008, ken uhl wrote:
>
>   
Isn't the name of all the checkboxes "tagbucket"?
> This should give you an array containing all the values of the *checked*
> checkboxes (e.g. $cb_name_X, $cb_name_Y, $cb_name_Z, ....)
>
>   
> check the HTML.  are the names and values being properly generated for
> the 'tagbucket' checkboxes on your form.
>
> you could also add
>
>   use Data::Dumper;
>
> and
>
>   print Dumper(@boxes)
>
> to help troubleshoot.
>
> HTH,
>
> Thomas
>
>
> Thomas Brightbill
> thomas at brightbill.net
> http://www.brightbill.net
>
> ------------------------------
> To expand a little more on my earlier message, I would think that this
> should give you nothing.  Aren't the checkboxes named 'tagbucket'?  Their
> values are $cb_name_X, $cb_name_Y, etc.
>
> The form shouldn't be passing the script any parameters named $cb_name_X,
> $cb_name_Y - only values in the tagbucket array.
>
> Also, I'm a little confused with the title of your posting - the fields
> are hidden?
>
> Thomas
>
>
>   
snip

_______________________________________________
SanFrancisco-pm mailing list
SanFrancisco-pm at pm.org
http://mail.pm.org/mailman/listinfo/sanfrancisco-pm



More information about the SanFrancisco-pm mailing list