View Complete Thread | FoxWeb Forum Home
Search:
Date:    Msg ID:   
From:    Thread:   
Subject:   
What you need to do is change the value of each checkbox, so that instead of "1", it corresponds to the key of the corresponding record.  The following code assumes that the key of your table is field SKCATEGORY.  If this is not the case, then you should adjust the code accordingly.  Our changes are highlighted in red:
 
*** TOP OF PAGE ***
Open the table
lnRECS = RECCOUNT()
<%
SELECT TABLE
IF Request.FormCount("btnchoice") > 0
   FOR I = 1 TO lnRECS
         RESPONSE.WRITE(Request.Form("btnchoice", M.I) + " is Checked<BR>")
   ENDFOR
ENDIF
%>
<HTML>
<HEAD>
<TITLE>PBS WebCases, Copyright, All Rights Reserved</TITLE>
<LINK rel="stylesheet" href="stylesheets/pbsstyles.css" TYPE="text/css">
</HEAD>
<BODY TOPMARGIN="0" LEFTMARGIN="0" BGCOLOR="#D2E5F3">
<FORM NAME=getit METHOD=post ACTION="service.fwx">
    <TABLE width=100%>
     <TR>
       <TD>
          <CENTER><B>Select Service</B></CENTER>
      </TD>
      <TD>
          <CENTER><B>Category</B></CENTER>
      </TD>
     </TR>
     <%FOR I = 1 TO lnrecs
     GO I%>
     <TR>
      <TD>
       <INPUT TYPE="checkbox" NAME="<%=SKCATEGORY%>">
      </TD>
      <TD>
       <%=(SKCATEGORY)%>
      </TD>
     </TR>
     <%ENDFOR%>
     <TR>
      <TD>
       <INPUT TYPE=SUBMIT NAME=btnchoice VALUE="      Add      ">
      </TD>
     </TR>
    </TABLE>
</FORM>
 

FoxWeb Support Team
support@foxweb.com email

Sent by Joe Goldsmith on 01/19/2004 02:20:14 PM:
Hello all. I have to build a page where each record in a lookup table is presented with a checkbox. A user would then check all records to be used. The problem I am having is finding which checkbox has been checked. Here is my code snippit.
 
*** TOP OF PAGE ***
Open the table
lnRECS = RECCOUNT()
 
<%
SELECT TABLE
IF Request.FormCount("btnchoice") > 0
   FOR I = 1 TO lnRECS
      GO I
      IF Request.Form("CHECK") = "1"
         RESPONSE.WRITE("Is Checked ")
      ENDIF
   ENDFOR
ENDIF
%>
 
<HTML>
<HEAD>
<TITLE>PBS WebCases, Copyright, All Rights Reserved</TITLE>
<LINK rel="stylesheet" href="stylesheets/pbsstyles.css" TYPE="text/css">
</HEAD>
<BODY TOPMARGIN="0" LEFTMARGIN="0" BGCOLOR="#D2E5F3">
 
<FORM NAME=getit METHOD=post ACTION="service.fwx">
    <TABLE width=100%>
     <TR>
       <TD>
          <CENTER><B>Select Service</B></CENTER>
      </TD>
      <TD>
          <CENTER><B>Category</B></CENTER>
      </TD>
     </TR>
     <%FOR I = 1 TO lnrecs
     GO I%>
     <TR>
      <TD>
       <INPUT TYPE="checkbox" NAME="check">
      </TD>
      <TD>
       <%=(SKCATEGORY)%>
      </TD>
     </TR>
     <%ENDFOR%>
     <TR>
      <TD>
       <INPUT TYPE=SUBMIT NAME=btnchoice VALUE="      Add      ">
      </TD>
     </TR>
    </TABLE>
</FORM>

Can someone please tell me the right FoxWeb construction to find each record checked please>

Joe