Results 1 to 4 of 4

Thread: how would you

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2000
    Posts
    29

    Question

    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>

  2. #2
    Guest
    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


  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 2000
    Posts
    29

    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

  4. #4
    Guest
    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
  •  



Click Here to Expand Forum to Full Width