|
Subject:
|
Listboxes and Checkboxes
|
|
Posted By:
|
vanguardmike
|
Post Date:
|
1/2/2007 3:36:03 PM
|
I have the following code: --- Option Explicit
Dim bValid, sErrorMsg, iListCount Dim aList(4) bValid = true iListCount = 0 If Request.Form("rt").Count = 0 Then bValid = false sErrorMsg = "Please Select a Request Type <br /> " Else For iListCount = 0 To Request.Form("rt").Count If Request.Form("rt").item(iListCount) = "on" Then aList(iListCount) = "Checked" End If Next End If If Len(Request.Form("policynumber")) < 10 Then bValid = false sErrorMsg = sErrorMsg & "Enter Policy Number in Format AAA1111111 <br /> " End If ---
When I run the code with the web page I get the error Request object, ASP 0105 (0x80004005) An array index is out of range. It Points to the line If Request.Form("rt").item(iListCount) = "on" Then
At this point I'm stuck. I've tried the get method instead of post, I've tried using htmlencode, but I always get the same error.
Any Suggestions
|
|
Reply By:
|
vanguardmike
|
Reply Date:
|
1/2/2007 3:37:58 PM
|
I've also tried it with If Request.Form("rt")(iListCount) = "on" Then
instead of
If Request.Form("rt").item(iListCount) = "on" Then
with the same results.
|
|
Reply By:
|
vanguardmike
|
Reply Date:
|
1/2/2007 4:28:43 PM
|
Since I couldn't figure out the error, I created a work around with some inspiration from another forum.
<% Option Explicit %> <% Dim bValid, bReqValid, sErrorMsg, sReqList, iCheckCount Dim aList(4) bValid = true bReqValid = false For iCheckCount = 0 to 4 If Request.Form("rt"&iCheckCount) <> "" Then aList(iCheckCount) = "Checked" sReqList = SReqList & "<br>" & Request.Form("rt"&iCheckCount) bReqValid = true End If Next If bReqValid = false Then sErrorMsg = "Please Select a Request Type <br /> " End If
If Len(Request.Form("policynumber")) < 10 Then bValid = false sErrorMsg = sErrorMsg & "Enter Policy Number in Format AAA1111111 <br /> " End If %>
|