VB Syntax error appears in one page but not the other?

Reply

Join Date: Apr 2007
Posts: 15
Reputation: Ortal is an unknown quantity at this point 
Solved Threads: 0
Ortal Ortal is offline Offline
Newbie Poster

VB Syntax error appears in one page but not the other?

 
0
  #1
Feb 12th, 2009
So Ive been working really hard to get a working ASP captcha to incorporate into my form (note, classic ASP not .net).

I FINALLY got it working in a test area, the form looks like this:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1.  
  2.  
  3. <form action="<%=Request.ServerVariables("SCRIPT_NAME")%>" method="post">
  4. <table border="0" width="570" align="center" cellpadding="1" cellspacing="0">
  5. <tr>
  6. <td align="right" valign="center"><%=font4%><font color="#ff0000">*&nbsp;</font>First Name:&nbsp;</td>
  7. <td align="left" valign="top"><input name="first" size="25" maxlength="50" tabindex="1"></td>
  8. </tr>
  9. <tr>
  10. <td align="right"><%=font4%><font color="#ff0000">*&nbsp;</font>Last Name:&nbsp;</font></td>
  11. <td align="left"><input name="last" size="25" maxlength="50" tabindex="2"></td>
  12. </tr>
  13. <tr>
  14. <td align="right"><%=font4%>Company Name:&nbsp;</font></td>
  15. <td align="left"><input name="company" size="25" maxlength="100" tabindex="3"></td>
  16. </tr>
  17. <tr>
  18. <td align="right"><%=font4%><font color="#ff0000">*&nbsp;</font>E-Mail&nbsp;Address:&nbsp;</font></td>
  19. <td align="left"><input name="email" size="25" maxlength="100" tabindex="4"></td>
  20. </tr>
  21. <tr>
  22. <td align="right"><%=font4%> Phone:&nbsp;</font></td>
  23. <td align="left"><input name="phone" size="25" maxlength="20" tabindex="5"></td>
  24. </tr>
  25.  
  26. <tr>
  27. <td align="right"><%=font4%> Part# 1:&nbsp;</font></td>
  28. <td align="left"><input name="partno1" size="25" maxlength="50" tabindex="6"></td>
  29. </tr>
  30. <tr>
  31. <td align="right"><%=font4%> Part# 2:&nbsp;</font></td>
  32. <td align="left"><input name="partno2" size="25" maxlength="50" tabindex="7"></td>
  33. </tr>
  34. <tr>
  35. <td align="right"><%=font4%> Part# 3:&nbsp;</font></td>
  36. <td align="left"><input name="partno3" size="25" maxlength="50" tabindex="8"></td>
  37. </tr>
  38. <tr>
  39. <td align="right"><%=font4%> Part# 4:&nbsp;</font></td>
  40. <td align="left"><input name="partno4" size="25" maxlength="50" tabindex="9"></td>
  41. </tr>
  42.  
  43. <tr>
  44. <td align="right" valign="top"><%=font4%><font color="#ff0000">*&nbsp;</font>Comments:&nbsp;</td>
  45. <td align="left"><textarea name="message" rows="8" wrap="virtual" cols="20" tabindex="10"></textarea></td>
  46. </tr>
  47. <tr>
  48. <td align="right" valign="top">&nbsp;</td>
  49. <td align="left">
  50.  
  51. <%
  52. 'Specify your captcha length here
  53. captchaLength = 5
  54.  
  55. Function captcha(captchaLength)
  56. if captchaLength > 15 then captchaLength = 15
  57. HighestValue = left(100000000000000,captchaLength)
  58. lowestValue = left(999999999999999,captchaLength)
  59. Randomize
  60. intHighestNumber = Int((HighestValue - LowestValue + 1) * Rnd) + LowestValue
  61. session("captcha") = Int(intHighestNumber)
  62. x = 1
  63. response.write vbcrlf & "<table width = ''>" & vbcrlf & vbtab & "<tr>" & vbcrlf
  64. while x <= captchaLength
  65. response.write vbtab & vbtab & "<td align = 'center'><img src = 'captcha.asp?captchaID=" & x & "' ></td>" & vbcrlf
  66. x = x + 1
  67. wend
  68. response.write vbtab & "</tr>" & vbcrlf & "</table>" & vbcrlf
  69. End Function
  70. %>
  71.  
  72. <%
  73. if request("action") = "captcha" then
  74. if cstr(request("captcha")) = cstr(session("captcha")) then
  75. response.write "Correct!"
  76. else
  77. response.write "Sorry, no match."
  78. end if
  79. end if
  80. %>
  81.  
  82. Enter Code: <input name="captcha"> <BR />
  83. <input type="submit" name="submit" src="images/b_submit.gif" border="0" tabindex="13" id="image1" value="Submit"></td>
  84. </tr>
  85. </table>
  86. </form>

it works great, but as soon as I move it over to the page I need it to and incorporate that form into it, I get a VB error. The error says:

Microsoft VBScript compilation error '800a03ea'

Syntax error

/RoHSCompliant2.asp, line 174

Function captcha(captchaLength)
^


so i know where the error is but not how to remedy it. why would it be doing this? what code in the rest of the page could pull such an error?

THANKS!
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 1
Reputation: navertech is an unknown quantity at this point 
Solved Threads: 0
navertech navertech is offline Offline
Newbie Poster

Re: VB Syntax error appears in one page but not the other?

 
0
  #2
Apr 22nd, 2009
We had a similar error and it transpired our function decleration was inside a loop.

It wasn't obvious to us at first, as the function dec was inside an include, and the loop was in the parent page.

Hope this helps.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC