[ASP-DW-ACCESS] Multiple checkboxes inside reapeat region with one submit button (1 Viewer)

dbmanalser84

Registered User.
Local time
Today, 09:32
Joined
Feb 26, 2008
Messages
52
I built a Card database and now I wan't to put it online using ASP and IIS. I build a page in dreamweaver, and created a relevant rsEdition (each card comes from specific edition). On page I've put rsEdition.txtEdition object and added a checkbox in front of it, and wrapped both in the repeat region and put them in frmEditionCheck, because there are 40 editions that needs to be displayed, and I've set int the database the default state for the checkbox is checked.
The next step is to display all cards from the database, using rsCard.txtCardName object. I've put that also on the page and wrapped a reapeat region around it too. Now, all cards are displayed succesfully, but I want to be able to filter the rsCard by clicking on checkboxes for each edition. How do I do that?

To make it easier here's the screen from the program of what I'm trying to build on my webpage:



As far as my work goes on this matter I've sucessfully created with the help of dreamweaver a checkbox that when I click it updates itself, but when I add a reapeat region (inside the form around the Checkbox and txtEdition Name), and put only one update button in the form (ate the edn of the form outside repeat region) I'm getting this error message:

Error Type:
ADODB.Field (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/allmymtgcards/cards/index.asp, line 105

Now, if I add the repeat region on form itself everything works fine, but then I have a submit button for each record in tblEditions, and that's not the way I wan't things to be. I wan't to have only one submit button that will update all the checked or unchecked checkboxes, Can someone help me change the dreamweaver code to make this work? Here's my code:

Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/connAllMyMTGCards.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
  If condition = "" Then
    MM_IIf = ifFalse
  Else
    MM_IIf = ifTrue
  End If
End Function
%>
<%
If (CStr(Request("MM_update")) = "form1") Then
  If (Not MM_abortEdit) Then
    ' execute the update
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_connAllMyMTGCards_STRING
    MM_editCmd.CommandText = "UPDATE tblEdition SET bitEditionChecked = ? WHERE intEditionID = ?"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 5, 1, -1, MM_IIF(Request.Form("bitEditionChecked"), 1, 0)) ' adDouble
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 5, 1, -1, MM_IIF(Request.Form("MM_recordId"), Request.Form("MM_recordId"), null)) ' adDouble
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "index.asp"
    If (Request.QueryString <> "") Then
      If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
        MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
      Else
        MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
      End If
    End If
    Response.Redirect(MM_editRedirectUrl)
  End If
End If
%>
<%
Dim rsEdition
Dim rsEdition_cmd
Dim rsEdition_numRows

Set rsEdition_cmd = Server.CreateObject ("ADODB.Command")
rsEdition_cmd.ActiveConnection = MM_connAllMyMTGCards_STRING
rsEdition_cmd.CommandText = "SELECT * FROM tblEdition"
rsEdition_cmd.Prepared = true

Set rsEdition = rsEdition_cmd.Execute
rsEdition_numRows = 0
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<p> </p>

<form action="<%=MM_editAction%>" method="post" name="form1" id="form1">
  <table>
    <tr valign="baseline">
      <td><input type="checkbox" name="bitEditionChecked" value="1"  <%If (CStr(rsEdition.Fields.Item("bitEditionChecked").Value) = CStr("True")) Then Response.Write("checked='checked'") : Response.Write("")%> />
      <%=(rsEdition.Fields.Item("txtEdition").Value)%> </td>
    </tr>
    <tr valign="baseline">
      <td><input type="submit" value="Filter" />      </td>
    </tr>
  </table>
  <input type="hidden" name="MM_update" value="form1" />
  <input type="hidden" name="MM_recordId" value="<%= rsEdition.Fields.Item("intEditionID").Value %>" />
</form>
<p> </p>
</body>
</html>
<%
rsEdition.Close()
Set rsEdition = Nothing
%>
 

Users who are viewing this thread

Top Bottom