Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic Checkboxes

Status
Not open for further replies.

JohannIcon

Programmer
Sep 3, 2002
440
MT
Hi All,

I have a complicated problem here, at least for me. I am generating a set of dynamic checkboxes, depending on the amount of entries I have in a database like this:-

<% if not rs1.eof then 'If not EOF of rs then print
Response.Write (rs1.Fields(&quot;menuName&quot;))
%>
</span> </font></div></td>
<td> <div align=&quot;left&quot;><font face=&quot;Arial, Helvetica, sans- serif&quot; size=&quot;2&quot;>
<%
response.Write &quot;<input name=menuCheck&quot; & n+1 & &quot; type=checkbox id=menuCheck value=&quot; & rs1(&quot;menuID&quot;) & &quot;>&quot;
%> <input type=&quot;hidden&quot; name=&quot;menuID&quot; value=&quot;<%=rs1(&quot;menuID&quot;)%>&quot;> <%
rs1.movenext
n = n + 1
end if %></span>

Now my aim is if the user clicks on the checkbox, I get the menuID to insert it into the database, and that I am already doing successfully like this:-

if NOT MenuCheckVal = &quot;&quot; then
'*** the insertion clause
sqlInsertMenu = &quot;INSERT INTO clientMenu (clientID,menuID,menuActive) VALUES (&quot; & ClientID & &quot;,&quot; & MenuCheckVal & &quot;,1);&quot;
rsInsertMenu.Open (sqlInsertMenu)

but what if the user does not click on the checkbox in the previous page? How can I get the menuID value so that I insert a '0' in the active field?

Can you please help me out here?

Thanks very much for your help and time!
 
i hope i understand your problem correctly
a suggestion:
give your checkboxes a unique name, for instance:
input type=&quot;checkbox&quot; name=&quot;check&quot; & rs(&quot;menuID&quot;)

on the next page loop through the same recordset, ask for the different values and insert within the loop

do while not rs.EOF

checkboxvalue = request.form(&quot;check&quot; & rs(&quot;menuID&quot;))

if checkboxvalue = ... then
sqlinsertMenu = ...
else
...
End if

loop

hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top