Return-Path: Delivered-To: apmail-perl-embperl-archive@perl.apache.org Received: (qmail 23677 invoked by uid 500); 19 Apr 2003 00:27:09 -0000 Mailing-List: contact embperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list embperl@perl.apache.org Received: (qmail 23664 invoked from network); 19 Apr 2003 00:27:08 -0000 Received: from h24-71-54-239.va.shawcable.net (HELO nyetwork.org) (24.71.54.239) by daedalus.apache.org with SMTP; 19 Apr 2003 00:27:08 -0000 Received: from nyetwork.org (bits.nyetwork.org [192.168.20.4]) by nyetwork.org (Postfix) with ESMTP id E47BB250D9; Fri, 18 Apr 2003 17:26:16 -0700 (PDT) Message-ID: <3EA09977.2060001@nyetwork.org> Date: Fri, 18 Apr 2003 17:33:59 -0700 From: Wim Kerkhoff User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-2?Q?Pawe=B3_Niewiadomski?= Cc: embperl@perl.apache.org Subject: Re: Multiple checkboxes with the same name References: <1050672125.2738.13.camel@niewiap.widzew.net> In-Reply-To: <1050672125.2738.13.camel@niewiap.widzew.net> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Pawe� Niewiadomski wrote: >I am using Embperl 1.3.4 in my website. I have the following problem: >Suppose I have the following page named checkbox.htm > > >
> 1
> 2
> 3
> 4
> >
> > >Now once I select one of the checkboxes, after I have clicked on submit >the checkbox stays checked as expected. If, however, I select multiple >checkboxes they are cleared after the page has reloaded. Is it possible >to somehow eliminate this problem? Theoretically I could split $fdat{cb} >into some array and then put an [- if (found_in_array(x)) {$fdat{cb}=x} >-], where x is the value of the following checkbox before every one of >them, but that looks pretty messy. > > Here's the method that I use. Change the name of the checkboxes slightly:
b1
2
3
4
Then, access them like this: [- @checks = grep {/cb:/} keys(%fdat); s/cb://g for @checks; -] Often checkboxes are used in a table where other columns might contain selects, input fields, more checkboxes, and so on. By putting the row sequence in the field name, order is preserved. Actually, in my example above, the value for the checkboxes is never used. Instead, the value is just so that it'll showed up as defined in %fdat. HTH, YMMV Wim --------------------------------------------------------------------- To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org For additional commands, e-mail: embperl-help@perl.apache.org