PDA

Click to See Complete Forum and Search --> : how would you


rigpig
Jan 4th, 2001, 10:40 AM
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, 12:02 PM
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

rigpig
Jan 4th, 2001, 12:23 PM
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, 12:34 PM
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