|
-
Jan 4th, 2001, 11:40 AM
#1
Thread Starter
Junior Member
If the checkboxes I am using have been created this way (below) with name="<%rsOptions.Fields("Description")%> and the value="<%=rsOptions.Fields("ID")%> how would you save them?
<tr>
<%Set rsOptions = Server.CreateObject("ADODB.Recordset")
rsOptions.Open strSQL, dbData, 1, 3
If Not(rsOptions.EOF AND rsOptions.BOF) Then rsOptions.MoveFirst
numincol = rsOptions.recordcount \3+1
Do Until rsOptions.EOF%>
<td valign="top">
<%for i = 1 to numincol
If rsOptions.EOF Then Exit For%>
<input type="checkbox" name="<%=rsOptions.Fields("Description")%>" value="<%=rsOptions.Fields("ID")%>" <%If rsOptions.Fields("Exist") <> vbNullString Then Response.Write " checked"%>>
<%=rsOptions.Fields("Description")%><br>
<%rsOptions.MoveNext
Next%>
</td>
<%Loop%>
</tr>
-
Jan 4th, 2001, 01:02 PM
#2
name the all of the checkboxes the same:
<input type="checkbox" name="Description" value="<%=rsOptions.Fields("ID")%>" <%If rsOptions.Fields("Exist") <> vbNullString Then Response.Write " checked"%>>
<%=rsOptions.Fields("Description")%><br>
Then to see which check boxes are checked:
For Each X in Request.Form ("IndProduct")
'do whatever here with the checked items.
Next
-
Jan 4th, 2001, 01:23 PM
#3
Thread Starter
Junior Member
they are named the same
this is what they named them
name="<%=rsOptions.Fields("Description")%>" and the
value="<%=rsOptions.Fields("ID")%>"
from what I understand of the code is that the loop for i to numincol will divide them equally onto the page. The checkboxes were created dynamically this way (again from what I undertstand). now wouldn't i do something like this
declare a new variable a
then do something like this?
for a = 1 to Request.Form(rsOptions.Fields("Description").Count
rsOptions.AddNew
rsOptions.Fields("CarID")=rsData.Fields("CarID")
rsOptions.Fields("OptionID")=Request.Form(rsOptions.Fields("Description")).Item(a)
rsOptions.Update
next
-
Jan 4th, 2001, 01:34 PM
#4
They are not named the same
rsOptions.Fields("Description") will be different for each element in the record set.
Just name each checkbox something like "chkDescription",
that way you can use request.form("chkDescription") and it will save each checked checkbox when using
For Each X in Request.Form ("chkDescription")
Next
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|