Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing an Array

Status
Not open for further replies.

1RobDog1

MIS
Jul 24, 2000
41
US
I need assistance. I have the following code that is used in my wizard type app. To maintain variables across all pages and if the user even goes back from page 20 to page 2 even. All variables are kept with the appropriate field arrays. I seem to have a problem with the LoadVariables function. I have tried many variations with no success. I have done this before in an old dead application and cannot remember what I did but this is still used today. So it's all still compatible with current version of ASP and IIS5.0.

I get a page cannot be displayed with this error.
Error Type:
Microsoft VBScript compilation (0x800A0400)
Expected statement
/myforms/Forms/New_Hire_ReAuthorization/include.asp, line 47


===Start of CODE
===Start of Form_P1.asp=============
<%
'Code here

loadHiddenFields 2
loadHiddenFields 3
loadHiddenFields 4
loadHiddenFields 5
loadHiddenFields 6
loadHiddenFields 7

loadVariables 1
loadVariables 2
loadVariables 3
loadVariables 4
loadVariables 5
loadVariables 6
loadVariables 7

'More Code here
%>
===End of Form_P1.asp=============

===Start of Form_P2.asp=============
<%
'Code here

loadHiddenFields 1
loadHiddenFields 3
loadHiddenFields 4
loadHiddenFields 5
loadHiddenFields 6
loadHiddenFields 7

loadVariables 1
loadVariables 2
loadVariables 3
loadVariables 4
loadVariables 5
loadVariables 6
loadVariables 7

'More Code here
%>
===End of Form_P2.asp=============



===Start of Include.ASP=============
aryPage1Fields = Array(&quot;lastname&quot;, &quot;firstname&quot;, &quot;position1&quot;, &quot;position2&quot;)

aryPage2Fields = Array(&quot;middleinit&quot;, &quot;maidenname&quot;, &quot;appdate&quot;, &quot;address&quot;, &quot;city&quot;, &quot;state&quot;, &quot;zip&quot;)

Sub loadHiddenFields(pageNumber)
Execute(&quot;thisArray = aryPage&quot; & pageNumber & &quot;Fields&quot;)
For i = 0 To Ubound(thisArray)
Execute(&quot;thisValue = Request.Form(&quot;&quot;&quot; & thisArray(i) & &quot;&quot;&quot;)&quot;)
Response.Write &quot;<INPUT type=&quot;&quot;hidden&quot;&quot; name=&quot;&quot;&quot; & thisArray(i) & &quot;&quot;&quot; value=&quot;&quot;&quot; & thisValue & &quot;&quot;&quot;>&quot; & vbCrLf
Next
End Sub

Sub loadVariables(pageNumber)
Execute(&quot;thisArray = aryPage&quot; & pageNumber & &quot;Fields&quot;)
For i = 0 To UBound(thisArray)


Line 47>>> Execute(thisArray(i) & &quot; = Request.Form(&quot;&quot;&quot; & thisArray(i) & &quot;&quot;&quot;)&quot;)


Next
End Sub
===End of Include.ASP=============
===End of CODE

Any assistance is greatly appreciated. Thanks... Thanks
-Robert
System Analyst/Programmer
 
Does the loadHiddenFields part work successfully? I mean when you check the HTML source on the browser right after you see this error, can you see the output of this line

Response.Write &quot;<INPUT type=&quot;&quot;hidden&quot;&quot; name=&quot;&quot;&quot; & thisArray(i) & &quot;&quot;&quot; value=&quot;&quot;&quot; & thisValue & &quot;&quot;&quot;>&quot; & vbCrLf


Also, is this the complete code? You're calling loadHiddenFields with 3,4,5,6 and 7 but you have only 1 and 2 as the source
 
Thanks Denoxis for the reply. Actually I found the problem. It's an oversight on my part. The code works great all the way through the only problem and what was generating the error was that on either of the page I have called the loadVariables 2. But in my include file I changed the arrary to be aryPage2Fields = Array(&quot;&quot;) just to start it off. Stupid me I didnt mirror that above. Sorry about that. But since the array had a empty value like that it was erroring out on the load variables function. I loaded the array with the proper values and now it works perfectly. Thanks a ton for your help and I am sorry for leaving out the bug I was having hehe. Now if I would have done what I wrote above it would have worked. DOH!!!! Thanks
-Robert
System Analyst/Programmer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top