|
| |
|
|
clum1
Posts: 762 From: Glasgow, Scotland Status: offline
|
Dropdown from Array - 3/23/2005 10:46:49
I'm having a problem with a dropdown that is populated from a GetRows array. It works fine until I update my table that holds the options by removing and then adding a record. E.g. 1 Option1 2 Option2 3 Option3 As the table uses auto increment, it becomes: 1 Option1 2 Option2 4 Option4 And my array fails when I try and pass it with the form: <select size="1" name="strJobCode_1_<%=Request("Day_Name")%>" tabindex="1">
<option selected value="Please Select...">Please Select...</option>
<%
For i = 0 to Ubound(arrJobCode,2)
Response.write("<option value="&arrJobCode(0,i)&"")
Response.write(">"&arrJobCode(1,i)&"</option>")
Next
%>
</select></td>
It's been a long day with loads of problems and I just can't see what I need to do to get the damn thing to read the arrays properly. I end up with the error: Subscript out of range: '[number: 10]' I think it's scrolling through my auto increment number but only to the number of records. Is there a way I can get it to scroll through the total number of records in the table? thanks Calum
_____________________________
kenilweb.com; simple, effective web design "So I said to the Gym instructor "Can you teach me to do the splits?" He said "How flexible are you?". I said "I can't make Tuesdays"." Tim Vine
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Dropdown from Array - 3/23/2005 11:01:05
That code at first glance looks fine. On what page does the error actually get shown: Subscript out of range: '[number: 10]' Is it the same page that you display the dropdown?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
clum1
Posts: 762 From: Glasgow, Scotland Status: offline
|
RE: Dropdown from Array - 3/23/2005 11:59:22
No; it's the page that the form is passed to, though it has subsequent uses of the array (it's a very complex app I'm writing!) cheers calum
_____________________________
kenilweb.com; simple, effective web design "So I said to the Gym instructor "Can you teach me to do the splits?" He said "How flexible are you?". I said "I can't make Tuesdays"." Tim Vine
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Dropdown from Array - 3/23/2005 12:32:13
quote:
it's the page that the form is passed to And what might that code look like - the code you're using for the form handler? Are you using the same array to gather the info from? Are you just Request.form'ing it?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
Giomanach
Posts: 6136 Joined: 11/19/2003 From: England Status: offline
|
RE: Dropdown from Array - 3/23/2005 12:36:48
Can I cut in? On this page: <!--#INCLUDE FILE="includes/db_conn.inc"-->
<!--#INCLUDE FILE="includes/common.inc"-->
<!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>
<%
if Request.QueryString("mode") = "loginerror" then
%>
<%
Response.Write("<title>" & myArray(0,i) & " :: Login Error</title>")
else
Response.Write("<title>" & myArray(0,i) & " :: Home</title>")
end if
%>
<link rel="stylesheet" href="styles/<%=myArray(2,i)%>" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<div id="page">
<div id="head">
<table width="100%">
<tr>
<td class="sitename" width="40%">
<%=myArray(0,i)%>
</td>
<td class="description">
<%=myArray(4,i)%>
</td>
</tr>
</table>
</div>
<div id="nav">
<!--#INCLUDE FILE="includes/nav.inc"-->
</div>
<br />
<div id="content">
<table width="100%">
<tr>
<td class="userinfo" valign="top" width="17%">
Logged In As:
<strong><%
if UserName = "" then
Response.Write("Guest")
Response.Write("<form action='login.asp' method='post'>")
Response.Write("<input type='text' name='txtUserName' value='UserName' onblur=""if(this.value=='') this.value='UserName'"" onfocus=""if(this.value=='UserName') this.value='';"" /><br /><br />")
Response.Write("<input type='password' value='Password' name='txtUserPass' onblur=""if(this.value=='') this.value='Password'"" onfocus=""if(this.value=='Password') this.value='';"" /><br /><br />")
Response.Write("<center><input type='submit' value='Login' /></center>")
Response.Write("</form>")
else
Response.Write UserName
Response.Write("<br /><a href=""logout.asp"" title=""Logout"">Logout</a>")
end if
Response.Write("<br />")
Response.Write AdminLink
%>
</strong>
<br /><br />
<strong>Newest User</strong><br /><br />
<a href="forum/profile.asp?UserID=<%=myUser(0,j)%>&name=<%=UserName%>" title="View <%=myUser(1,j)%>'s Profile"><%=myUser(1,j)%></a>
<% NEXT %>
<br /><br />
<strong>Number Of Users:</strong><br />
<center>
<%
Set conn = CreateObject("ADODB.Connection")
sql = "SELECT * FROM users"
conn.Open MyDSN
Set rs = conn.execute(sql)
if not rs.eof then
rsArray = rs.GetRows()
nr = UBound(rsArray, 2) + 1
response.write"" & nr & ""
end if
rs.close: set rs = nothing
conn.close: set conn = nothing
%>
</center>
<br />
<%=NoRecords%>
<br /><br />
</td>
<td class="maincontent" valign="top">
<%
if Request.QueryString("mode") = "loginerror" then
%>
<%
Response.Write("<span class=""title"">" & myArray(0,i) & " - Login Error</span>")
Response.Write("<br /><br />")
Response.Write("There was a problem with your login. This was because either your UserName or Password were incorrect. Please Try Again.")
Response.Write("<center><form action='login.asp' method='post'>")
Response.Write("<table>")
Response.Write("<tr><td>UserName</td><td><input type='text' name='txtUserName' /></td></tr>")
Response.Write("<tr><td>Password</td><td><input type='password' name='txtUserPass' /></td></tr>")
Response.Write("<tr><td colspan=""2"" align=""center""><input type=""submit"" value=""Login"" /> <input type=""reset"" value=""Cancel"" onclick=""location.go(default.asp);"" /></td></tr>")
Response.Write("</table>")
Response.Write("</form></center>")
else
%>
<span class="title"><%=myArray(0,i)%></span>
<br /><br />
<%
Response.Write("<strong>")
Response.Write(rsHomeData("date"))
Response.Write("</strong>")
Response.Write("<br />")
Response.Write(rsHomeData("main"))
%>
<% End If %>
</td>
</tr>
</table>
</div>
<div id="footer">
<table width="100%">
<tr>
<td width="50%">
<a href="about.asp" title="About Us">About Us</a> | <a href="contact.asp" title="Contact Us">Contact Us</a> | <a href="faq.asp" title="FAQ">FAQ</a>
</td>
<td style="copyright" align="right">
© <%=myArray(1,i)%><br />
Powered By <a href="http://asp.giouk.co.uk" title="GioPortal">GioPortal</a> Version <%=myArray(3,i)%>
<% NEXT %>
</td>
</tr>
</table>
</div>
</div>
</body>
</html> I have three record sets, soon to be turned into one, but two of them are done in similar ways, when I tried to do the third one in the same way, I got a similar error to yours Calum, if you remove one of the other recordsets on the same DB, does it clear the error? </$0.02> Dan
_____________________________
|
|
|
|
clum1
Posts: 762 From: Glasgow, Scotland Status: offline
|
RE: Dropdown from Array - 3/23/2005 12:49:54
RDouglass: I'm Request.Forming the data on the new page then using the same array again for another drop down (it's a Timesheet system; the new page grabs Monday's data form previous then asks for Tuesday's etc.) Dan: I'm away from the office now so can't experiment; I note your line nr = UBound(rsArray, 2) + 1 Re. the +1 - is that to avoid a shift in the data? I seem to get my results out by 1 and am subtracting it at a later stage... confusing! cheers Calum
_____________________________
kenilweb.com; simple, effective web design "So I said to the Gym instructor "Can you teach me to do the splits?" He said "How flexible are you?". I said "I can't make Tuesdays"." Tim Vine
|
|
|
|
Giomanach
Posts: 6136 Joined: 11/19/2003 From: England Status: offline
|
RE: Dropdown from Array - 3/23/2005 12:54:54
quote:
Dan: I'm away from the office now so can't experiment; I note your line nr = UBound(rsArray, 2) + 1 Re. the +1 - is that to avoid a shift in the data? I seem to get my results out by 1 and am subtracting it at a later stage... That bit's on the ASP used to count the number of records: <%
Set conn = CreateObject("ADODB.Connection")
sql = "SELECT * FROM users"
conn.Open MyDSN
Set rs = conn.execute(sql)
if not rs.eof then
rsArray = rs.GetRows()
nr = UBound(rsArray, 2) + 1
response.write"" & nr & ""
end if
rs.close: set rs = nothing
conn.close: set conn = nothing
%> But it did help get round the other recordset problems I had, like the error your getting I'm building an ASP Portal as a side Project... If it's any help, this is common.inc: <%
UserName = Request.Querystring("name")
strUserID = Request.Querystring("UserID")
%>
<%
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT SiteName, Copyright, cssStyle, version, Description FROM sitedetails"
'Create an ADO recordset object
Set rsSiteName = Server.CreateObject("ADODB.Connection")
'Open the recordset with the SQL query
rsSiteName.Open MyDSN
set sitedetail=rsSiteName.Execute(strSQL)
myArray = sitedetail.getrows
rsSiteName.close
FOR i = 0 to Ubound(myArray,2)
%>
<%
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT TOP 1 UserID, UserName, admin FROM users ORDER BY UserID desc"
'Create an ADO recordset object
Set rsNewUser = Server.CreateObject("ADODB.Connection")
'Open the recordset with the SQL query
rsNewUser.Open MyDSN
set NewUser=rsNewUser.Execute(strSQL)
myUser = NewUser.getrows
rsNewUser.close
FOR j = 0 to Ubound(myUser,2)
%>
<%
'Set Recordset
Set rsHomeData = Server.CreateObject("ADODB.Recordset")
'Intialise the SQL statement to query the DB
strSQL="SELECT TOP 1 main, date FROM home ORDER BY date desc"
'Open the recordset with the SQL query
rsHomeData.Open strSQL, myDSN
%>
<%
'Set Recordset
Set rsViewProfile = Server.CreateObject("ADODB.Recordset")
'Intialise the SQL statement to query the DB
strSQL="SELECT UserID, RealName, Location, DOB, Occupation, Avatar, Sig FROM users WHERE (UserID LIKE '" & strUserID & "')"
'Open the recordset with the SQL query
rsViewProfile.Open strSQL, myDSN
set strRealName=rsViewProfile("RealName")
set strLocation=rsViewProfile("Location")
set strDOB=rsViewProfile("DOB")
set strOccupation=rsViewProfile("Occupation")
set strAvatar=rsViewProfile("Avatar")
set strSig=rsViewProfile("Sig")
%> I know it's messy right now, but I'm gonna neaten it up in the near future
_____________________________
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Dropdown from Array - 3/23/2005 13:24:28
quote:
I'm Request.Forming the data on the new page then using the same array Don't want to confuse (Dan's taking another approach) but can you post the code you're using to collect those items? IOW where is the error actually occuring? Does the error give you a line number?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
clum1
Posts: 762 From: Glasgow, Scotland Status: offline
|
RE: Dropdown from Array - 3/23/2005 16:53:43
Thanks for your continued help. Here's the error: Microsoft VBScript runtime (0x800A0009) Subscript out of range: '[number: 10]' /intranet/support/timesheets/add/inc_form_row_1.asp, line 71 (basically this is the first data row of a table - because it's so complex but repeatable, I'm creating each row as a separately included page this is inc_form_row_1.asp) I've included the code with Line 71 marked: <%
Dim strJobCodeName_1_Sun, strJobCodeName_1_Mon, strJobCodeName_1_Tue, strJobCodeName_1_Wed, strJobCodeName_1_Thu, strJobCodeName_1_Fri, strJobCodeName_1_Sat
Dim strJobCode_1_Sun, strJobCode_1_Mon
IF Request.Form("strJobCode_1_Sun") <> "Please Select..." THEN
IF Request("Day_Name") = "Mon" THEN
strJobCodeName_1_Sun = (Request.Form("strJobCode_1_Sun") - 1)
' strJobCodeName_1_Sun = (Request.Form("strJobCode_1_Sun"))
Session("strJobCodeName_1_Sun") = strJobCodeName_1_Sun
END IF
END IF
IF Request.Form("strJobCode_1_Mon") <> "Please Select..." THEN
IF Request("Day_Name") = "Tue" THEN
strJobCodeName_1_Mon = (Request.Form("strJobCode_1_Mon") - 1)
Session("strJobCodeName_1_Mon") = strJobCodeName_1_Mon
END IF
'ELSE
' strJobCodeName_1_Mon = 0
END IF
IF Request.Form("strJobCode_1_Tue") <> "Please Select..." AND Request.Form("strJobCode_1_Tue") <> "" THEN
IF Request("Day_Name") = "Wed" THEN
strJobCodeName_1_Tue = (Request.Form("strJobCode_1_Tue") - 1)
Session("strJobCodeName_1_Tue") = strJobCodeName_1_Tue
END IF
END IF
IF Request.Form("strJobCode_1_Wed") <> "Please Select..." AND Request.Form("strJobCode_1_Wed") <> "" THEN
IF Request("Day_Name") = "Thu" THEN
strJobCodeName_1_Wed = (Request.Form("strJobCode_1_Wed") - 1)
Session("strJobCodeName_1_Wed") = strJobCodeName_1_Wed
END IF
END IF
IF Request.Form("strJobCode_1_Thu") <> "Please Select..." AND Request.Form("strJobCode_1_Thu") <> "" THEN
IF Request("Day_Name") = "Fri" THEN
strJobCodeName_1_Thu = (Request.Form("strJobCode_1_Thu") - 1)
Session("strJobCodeName_1_Thu") = strJobCodeName_1_Thu
END IF
END IF
IF Request.Form("strJobCode_1_Fri") <> "Please Select..." AND Request.Form("strJobCode_1_Fri") <> "" THEN
IF Request("Day_Name") = "Sat" THEN
strJobCodeName_1_Fri= (Request.Form("strJobCode_1_Fri") - 1)
Session("strJobCodeName_1_Fri") = strJobCodeName_1_Fri
END IF
END IF
IF Request.Form("strJobCode_1_Sat") <> "Please Select..." AND Request.Form("strJobCode_1_Sat") <> "" THEN
IF Request("Day_Name") = "WE" THEN
strJobCodeName_1_Sat= (Request.Form("strJobCode_1_Sat") - 1)
Session("strJobCodeName_1_Sat") = strJobCodeName_1_Sat
END IF
END IF
%>
<tr>
<!-- Sunday -->
<%
IF (Session("strJobCode_1_Sun") <> "Please Select..." AND Session("numHours_1_Sun") = "0")_
OR (Session("strJobCode_1_Sun") = "Please Select..." AND Session("numHours_1_Sun") <> "0")_
OR (Session("strJobCode_1_Sun") = "Please Select..." AND Session("numHours_1_Sun") = "0")_
THEN
'third part of the IF stmt is only used in Row 1 as we don't want any blank values in this only.
numError_1 = numError_1 + 1
%>
<td class="ContentCell">
<span class="RedText">Error!</span>
<%ELSE%>
<td class="GreyedContentCell">
LINE 71!!! <%=Session("numHours_1_Sun")%>@ <%=arrJobCode(1,Session("strJobCodeName_1_Sun"))%>
<%END IF%>
</td>
<!-- Monday -->
<%IF Request("Day_Name") = "Mon" THEN%><!-- #include file="inc_array_job_code_1.asp" --><%END IF%>
<%IF Request("Day_Name") <> "Sun" AND Request("Day_Name") <> "Mon" THEN%>
<%
IF (Session("strJobCode_1_Mon") <> "Please Select..." AND Session("numHours_1_Mon") = "0")_
OR (Session("strJobCode_1_Mon") = "Please Select..." AND Session("numHours_1_Mon") <> "0")_
OR (Session("strJobCode_1_Mon") = "Please Select..." AND Session("numHours_1_Mon") = "0")_
THEN
numError_1 = numError_1 + 1
%>
<td class="ContentCell">
<span class="RedText">Error!</span>
<%ELSE%>
<td class="GreyedContentCell">
<%=Session("numHours_1_Mon")%> <%=arrJobCode(1,Session("strJobCodeName_1_Mon"))%>
<%END IF%>
</td>
<%END IF%>
<!-- Tuesday -->
<%IF Request("Day_Name") = "Tue" THEN%><!-- #include file="inc_array_job_code_1.asp" --><%END IF%>
<%IF Request("Day_Name") <> "Sun" AND Request("Day_Name") <> "Mon" AND Request("Day_Name") <> "Tue" THEN%>
<%
IF (Session("strJobCode_1_Tue") <> "Please Select..." AND Session("numHours_1_Tue") = "0") _
OR (Session("strJobCode_1_Tue") = "Please Select..." AND Session("numHours_1_Tue") <> "0") _
OR (Session("strJobCode_1_Tue") = "Please Select..." AND Session("numHours_1_Tue") = "0") _
THEN
numError_1 = numError_1 + 1
%>
<td class="ContentCell">
<span class="RedText">Error!</span>
<%ELSE%>
<td class="GreyedContentCell">
<%=Session("numHours_1_Tue")%> <%=arrJobCode(1,Session("strJobCodeName_1_Tue"))%>
<%END IF%>
</td>
<%END IF%>
<!-- Wednesday -->
<%IF Request("Day_Name") = "Wed" THEN%><!-- #include file="inc_array_job_code_1.asp" --><%END IF%>
<%IF Request("Day_Name") <> "Sun" AND Request("Day_Name") <> "Mon" AND Request("Day_Name") <> "Tue" AND Request("Day_Name") <> "Wed" THEN%>
<%
IF (Session("strJobCode_1_Wed") <> "Please Select..." AND Session("numHours_1_Wed") = "0")_
OR (Session("strJobCode_1_Wed") = "Please Select..." AND Session("numHours_1_Wed") <> "0")_
OR (Session("strJobCode_1_Wed") = "Please Select..." AND Session("numHours_1_Wed") = "0")_
THEN
numError_1 = numError_1 + 1
%>
<td class="ContentCell">
<span class="RedText">Error!</span>
<%ELSE%>
<td class="GreyedContentCell">
<%=Session("numHours_1_Wed")%> <%=arrJobCode(1,Session("strJobCodeName_1_Wed"))%>
<%END IF%>
</td>
<%END IF%>
<!-- Thursday -->
<%IF Request("Day_Name") = "Thu" THEN%><!-- #include file="inc_array_job_code_1.asp" --><%END IF%>
<%IF Request("Day_Name") <> "Sun" AND Request("Day_Name") <> "Mon" AND Request("Day_Name") <> "Tue" AND Request("Day_Name") <> "Wed" AND Request("Day_Name") <> "Thu" THEN%>
<%
IF (Session("strJobCode_1_Thu") <> "Please Select..." AND Session("numHours_1_Thu") = "0")_
OR (Session("strJobCode_1_Thu") = "Please Select..." AND Session("numHours_1_Thu") <> "0")_
OR (Session("strJobCode_1_Thu") = "Please Select..." AND Session("numHours_1_Thu") = "0")_
THEN
numError_1 = numError_1 + 1
%>
<td class="ContentCell">
<span class="RedText">Error!</span>
<%ELSE%>
<td class="GreyedContentCell">
<%=Session("numHours_1_Thu")%> <%=arrJobCode(1,Session("strJobCodeName_1_Thu"))%>
<%END IF%>
</td>
<%END IF%>
<!-- Friday -->
<%IF Request("Day_Name") = "Fri" THEN%><!-- #include file="inc_array_job_code_1.asp" --><%END IF%>
<%IF Request("Day_Name") <> "Sun" AND Request("Day_Name") <> "Mon" AND Request("Day_Name") <> "Tue" AND Request("Day_Name") <> "Wed" AND Request("Day_Name") <> "Thu" AND Request("Day_Name") <> "Fri" THEN%>
<%
IF (Session("strJobCode_1_Fri") <> "Please Select..." AND Session("numHours_1_Fri") = "0")_
OR (Session("strJobCode_1_Fri") = "Please Select..." AND Session("numHours_1_Fri") <> "0")_
OR (Session("strJobCode_1_Fri") = "Please Select..." AND Session("numHours_1_Fri") = "0")_
THEN
numError_1 = numError_1 + 1
%>
<td class="ContentCell">
<span class="RedText">Error!</span>
<%ELSE%>
<td class="GreyedContentCell">
<%=Session("numHours_1_Fri")%> <%=arrJobCode(1,Session("strJobCodeName_1_Fri"))%>
<%END IF%>
</td>
<%END IF%>
<!-- Saturday -->
<%IF Request("Day_Name") = "Sat" THEN%><!-- #include file="inc_array_job_code_1.asp" --><%END IF%>
<%IF Request("Day_Name") = "WE" THEN%>
<%
IF (Session("strJobCode_1_Sat") <> "Please Select..." AND Session("numHours_1_Sat") = "0")_
OR (Session("strJobCode_1_Sat") = "Please Select..." AND Session("numHours_1_Sat") <> "0")_
OR (Session("strJobCode_1_Sat") = "Please Select..." AND Session("numHours_1_Sat") = "0")_
THEN
numError_1 = numError_1 + 1
%>
<td class="ContentCell">
<span class="RedText">Error!</span>
<%ELSE%>
<td class="GreyedContentCell">
<%=Session("numHours_1_Sat")%> <%=arrJobCode(1,Session("strJobCodeName_1_Sat"))%>
<%END IF%>
</td>
<%END IF%>
<%IF Request("Day_Name") <> "WE" THEN%>
<td class="ContentCell"><select name="numHours_1_<%=Request("Day_Name")%>" tabindex="2"><!-- #include file="hours.htm" --></select></td> </b>
</b>
</b></b>
<%END IF%></tr>
_____________________________
kenilweb.com; simple, effective web design "So I said to the Gym instructor "Can you teach me to do the splits?" He said "How flexible are you?". I said "I can't make Tuesdays"." Tim Vine
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Dropdown from Array - 3/24/2005 8:54:15
Is that all the code from the page? 'Cause if so, thatguy is correct when he says that the array is not defined on that page. An array is not like a session in that it is only built once for that page and not stored. You treat it just like any other variable and build it for every page. You could always put it in an include page. I do that frequently for those kinds of things (common dropdowns, etc.). Try building the array again on that page before you attempt to call line 71. That help any?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
clum1
Posts: 762 From: Glasgow, Scotland Status: offline
|
RE: Dropdown from Array - 3/24/2005 8:54:23
Thanks TG; I'd tried that but it doesn't seem to work either! (you're not wrong about the obvious being hard to spot BTW; I spent much of yesterday tracing what turned out to be all my Option groups inadvertently being named incorrectly - d'oh!) cheers calum
_____________________________
kenilweb.com; simple, effective web design "So I said to the Gym instructor "Can you teach me to do the splits?" He said "How flexible are you?". I said "I can't make Tuesdays"." Tim Vine
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Dropdown from Array - 3/24/2005 8:58:10
quote:
strJobCodeName_1_Sun = (Request.Form("strJobCode_1_Sun") - 1) Another thought I had was to check this to ensure it's a number. Can you do a Response.write("strJobCodeName_1_Sun") right after this to see if you're getting what you expect? If not, you may have to do something like: strJobCodeName_1_Sun = (cint(Request.Form("strJobCode_1_Sun")) - 1)
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
clum1
Posts: 762 From: Glasgow, Scotland Status: offline
|
RE: Dropdown from Array - 3/24/2005 9:15:08
Hmm... Using: <% strJobCodeName_1_Sun = (cint(Request.Form("strJobCode_1_Sun"))) %> <%=strJobCodeName_1_Sun%> gives the result 9 for Holiday and 11 for Test Code. Dropping the line <%=cInt(arrJobCode(2,Session("strJobCodeName_1_Sun")))%> after that code give the correct result for 9 (Holiday) and the same error (Subscript out of range: '[number: 10]) for 11 Which to me, means that it's reading my id field in my database, rather than the total number of records. Am I right? Thanks again for all this help! cheers Calum
_____________________________
kenilweb.com; simple, effective web design "So I said to the Gym instructor "Can you teach me to do the splits?" He said "How flexible are you?". I said "I can't make Tuesdays"." Tim Vine
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Dropdown from Array - 3/24/2005 9:16:57
quote:
Which to me, means that it's reading my id field in my database, rather than the total number of records. Am I right? That is definitely one possiblity and that would be where I'd look.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
clum1
Posts: 762 From: Glasgow, Scotland Status: offline
|
RE: Dropdown from Array - 3/24/2005 10:01:16
That must be the problem: 8 - admin 9 - Holiday 11 - Error! So how do I go about matching it to the actual number of records rather than the id field? If it was a simple SQL query, I could do it easily... BTW re your earlier point RD, the array is stored as a Session Var having been created at the first page. <tearing out my hair> calum
_____________________________
kenilweb.com; simple, effective web design "So I said to the Gym instructor "Can you teach me to do the splits?" He said "How flexible are you?". I said "I can't make Tuesdays"." Tim Vine
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Dropdown from Array - 3/24/2005 10:15:32
quote:
<%=Session("numHours_1_Sun")%>@ <%=arrJobCode(1,Session("strJobCodeName_1_Sun"))%> One way might be to alter the original dropdown values like so: <% For i = 0 to Ubound(arrJobCode,2) Response.write("<option value="&arrJobCode(0,i)&"") Response.write(">"&arrJobCode(1,i)&"</option>") Next %> Is column 0 the record ID? I don't know what other problems will fall out of this but I'd use the recordID as the value in the dropdown. That any help?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|