Don,

the way I would do this is to give all the check boxes in a group that I
want to check, the same name,

<form name="myForm>
     <td><div align="left">
>          <INPUT TYPE=CHECKBOX NAME="check1" VALUE="*ALL" >All Contact
Types<BR>
>          <INPUT TYPE=CHECKBOX NAME="check1" VALUE="COM MGR"
checked>Compliance Manager<BR>
>          <INPUT TYPE=CHECKBOX NAME="check1" VALUE="REG MGR" >Regional
Manager<BR>
>          <INPUT TYPE=CHECKBOX NAME="check1" VALUE="GEN MGR"
checked>General Manager<BR>

to check if the checkboxes are selected:

for (i=0;i<myForm.check1.length;i++)
{
    if (myForm.check1[i].selected == true)
    {

(Im assuming your checking this in your client side javascript?)

cheers
Colin.W

----- Original Message -----
From: "Don Freeman" <DFreeman@xxxxxxxxxxxxxxx>
To: "Web Enabling the AS400 / iSeries" <web400@xxxxxxxxxxxx>
Sent: Thursday, January 22, 2004 6:36 PM
Subject: [WEB400] Checkbox naming and reference


> I have a variable number of checkboxes I am displaying in the /$section
generated by an RPG program.  The number of checkboxes is unknown until
program execution.  My problem is how do I reference each checkbox to see if
it is checked and what the value is of that checkbox:
> ----------------------------------------------
> The HTML section looks like this:
>    <tr>
>      <td><div align="left"><font color="white">*</font>Contact
Type:</div></td>
>      <td><div align="left">
> /$ContTypList
>          <INPUT TYPE=CHECKBOX
>                 NAME="/%vdBoxNbr%/"
>                 VALUE="/%vdContTypVal%/"
>                 /%vdContTypChecked%/>/%vdContTypDsp%/<BR>
> /$ContTypListX
>                     <input type="hidden" name="ChkBoxTotal"
value="/%vdChkBoxTotal%/">
>                     <!-- the above holds the number of checkboxes actually
generated -->
>      </td>
>    </tr>
>
> -----------------------------------------------
> This is one example of what the generated HTML in the section could look
like in one of many circumstances:
>
>    <tr>
>      <td><div align="left"><font color="white">*</font>Contact
Type:</div></td>
>      <td><div align="left">
>          <INPUT TYPE=CHECKBOX NAME="1" VALUE="*ALL" >All Contact Types<BR>
>          <INPUT TYPE=CHECKBOX NAME="2" VALUE="COM MGR" checked>Compliance
Manager<BR>
>          <INPUT TYPE=CHECKBOX NAME="3" VALUE="REG MGR" >Regional
Manager<BR>
>          <INPUT TYPE=CHECKBOX NAME="4" VALUE="GEN MGR" checked>General
Manager<BR>
>          <input type="hidden" name="ChkBoxTotal" value="4">
>      </td>
>    </tr>
> -----------------------------------------------
> As you can see I now have the number of checkboxes available to me for any
looping that may be needed but I still don't know how I am going to test
each one within the loop.
>
> If I code (forgetting about the loop for now):
>
>   If (vdBoxNbr = '1') and (vdContTypChecked = 'checked');
>      DBfield1 = vdContTypVal;
>   EndIf;
>
> How do I reference vdContTypChecked and vdContTypVal so that I can be sure
that they are the ones associated with the first checkbox (vdBoxNbr = '1'),
and so on through checkbox #4?
>
>
> _______________________________________________
> This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
> To post a message email: WEB400@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/web400
> or email: WEB400-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/web400.
>
>



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.