xeroflux
asked on
Maintain state of checkbox While Paging
I need to maintain a checkbox's "checked" status while paging back and forth with a querystring on the same page. I think this will require vb or javascript to work.
Here is my code:
<%
Dim i
For i=1 To pagesize
If NOT RS.EOF Then
r = n Mod 2
if r <> 0 then
rowColor = "#FFF0AF"
else
rowColor = "#F0FFCF"
end if
Dim vAuthCode,vNPANXX,vAddDate ,vActiveDa te,vDeacti veDate
Dim vRouting,vCarrier,vAuthTyp e
vAuthCode = RS("auth_code")
vA_NPA = left(RS("auth_code"),3)
vA_NXX = mid(RS("auth_code"),4,3)
vA_Num = right(RS("auth_code"),4)
%>
<tr bgcolor="<%=rowcolor%>">
<td align=center nowrap><font class=content><%=vA_NPA%>- <%=vA_NXX% >-<%=vA_Nu m%></font> </td>
<td align=center nowrap><input type=checkbox name="ordernum" id="ordernum" value="<%=vAuthCode%>"></t d>
</tr>
<%
n=n+1
RS.MoveNext
End If
Next
%>
<tr><td colspan=99 align=right bgcolor="#BBBBBB">
<input type=hidden name="action" id="action" value="bulkOrder"><input style="width: 200px;" class=button type=submit name=submit1 id=submit1 value="RESERVE SELECTED NUMBERS" onClick="return confirmSubmit()"></td></tr ></table>< /td></tr>< /table>
</td></tr></table>
<p>
<blockquote><font class=content><b>Jump to Page: </b>
<%
if not isEmpty(Request.QueryStrin g("sort")) then
column=Request.QueryString ("sort")
vSort="sort=" & column
ElseIf not isEmpty(Request.QueryStrin g("sortd") ) then
column=Request.QueryString ("sortd")
vSort="sortd=" & column
Else
vSort=auth_code
End If
Dim x, lb, ub
For x=1 To numpages
lb = (x-1) * pagesize + 1
ub = x * pagesize
If ub > numrecs Then ub = numrecs
If x <> mypage Then
Response.Write("<a class=content href=number_inventory.asp? page=" & x & "&select2="& vFilter2 &"&recs=" & pagesize & "&"& vSort &">" & lb & "-" & ub & "</A>")
Else
Response.Write(lb & "-" & ub)
End If
If x <> numpages Then Response.Write(" | ")
Next
End If
RS.Close
Set RS = Nothing
objConn.Close
Set objConn = Nothing
%>
Here is my code:
<%
Dim i
For i=1 To pagesize
If NOT RS.EOF Then
r = n Mod 2
if r <> 0 then
rowColor = "#FFF0AF"
else
rowColor = "#F0FFCF"
end if
Dim vAuthCode,vNPANXX,vAddDate
Dim vRouting,vCarrier,vAuthTyp
vAuthCode = RS("auth_code")
vA_NPA = left(RS("auth_code"),3)
vA_NXX = mid(RS("auth_code"),4,3)
vA_Num = right(RS("auth_code"),4)
%>
<tr bgcolor="<%=rowcolor%>">
<td align=center nowrap><font class=content><%=vA_NPA%>-
<td align=center nowrap><input type=checkbox name="ordernum" id="ordernum" value="<%=vAuthCode%>"></t
</tr>
<%
n=n+1
RS.MoveNext
End If
Next
%>
<tr><td colspan=99 align=right bgcolor="#BBBBBB">
<input type=hidden name="action" id="action" value="bulkOrder"><input style="width: 200px;" class=button type=submit name=submit1 id=submit1 value="RESERVE SELECTED NUMBERS" onClick="return confirmSubmit()"></td></tr
</td></tr></table>
<p>
<blockquote><font class=content><b>Jump to Page: </b>
<%
if not isEmpty(Request.QueryStrin
column=Request.QueryString
vSort="sort=" & column
ElseIf not isEmpty(Request.QueryStrin
column=Request.QueryString
vSort="sortd=" & column
Else
vSort=auth_code
End If
Dim x, lb, ub
For x=1 To numpages
lb = (x-1) * pagesize + 1
ub = x * pagesize
If ub > numrecs Then ub = numrecs
If x <> mypage Then
Response.Write("<a class=content href=number_inventory.asp?
Else
Response.Write(lb & "-" & ub)
End If
If x <> numpages Then Response.Write(" | ")
Next
End If
RS.Close
Set RS = Nothing
objConn.Close
Set objConn = Nothing
%>
input type=checkbox name="ordernum" id="ordernum" value="<%=vAuthCode%>" <% if( Request.QueryString( "ordernum" ) <> "" ) then Response.Write( "checked" ) end if%> >
Building on justinbillig's comment.
Lets say you have this variable that you want to carry over to another page..
CurTime = now()
You 1st need to send it to the next page. The only way this can be done is with a Form or Querystring depending on your needs. I have done it with both.
Response.redirect("nextpag e.asp?CurT ime=" & CurTime)
Then on the next page you can get the CurTime value using this:
CurTime = Request.QueryString("CurTi me")
Lets say you have this variable that you want to carry over to another page..
CurTime = now()
You 1st need to send it to the next page. The only way this can be done is with a Form or Querystring depending on your needs. I have done it with both.
Response.redirect("nextpag
Then on the next page you can get the CurTime value using this:
CurTime = Request.QueryString("CurTi
ASKER
The pagination runs on the same page. The only time the form would be submitted is after you've checked your checkboxes from the various pages.
The paging querystring could be used to trigger a javascript that detects what has been checked on each page and holds them in a cookie or array.
Neither of your answers really solves the problem.
The paging querystring could be used to trigger a javascript that detects what has been checked on each page and holds them in a cookie or array.
Neither of your answers really solves the problem.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.