Hi everyone,

I'm new to ASP and am trying to insert a basic captcha into a form. I can get the captcha to work fine; however, the moment I insert an action into the <form>, I receive error. On submit, I want the action to go to "thankyou.asp" where the form is then processed. This action insertion is making my captcha skip check. I don't understand the code enough to figure out how to fix this. Any help would be greatly appreciated. Code is below:

In the Head of my Page:

Code:
<head>

    <script type="text/javascript" language="javascript">
        function RefreshImage(valImageId) {
            var objImage = document.getElementById(valImageId)
            if (objImage == undefined) {
                return;
            }
            var now = new Date();
            objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();
        }
    </script>

	<script type="text/javascript">
		function validateForm(myForm) {
		
			var reason = "";	
		
			reason += validateEmpty(myForm.firstname);
			reason += validateEmpty(myForm.lastname);
			reason += validateEmail(myForm.email);
			reason += validateCaptcha(myForm.txtCaptcha);
			
			if (reason != "") {
				alert("Please complete the required information.\n" + reason);	
				return false;	
			}
			// alert("No errors found!");	
			return true;
		}	


	
		// validate the captch entry
		function validateCaptcha() {
	        var str1 = removeSpaces(document.getElementById('imgCaptcha').value);
	        var str2 = removeSpaces(document.getElementById('txtInput').value);
	        if (str1 == str2){
				validateEmpty();
			} else {    
				//document.getElementById("txtInput").style.border = "2px solid rgb(255,0,0)";
	        	return false;
			}  
	    }//end validateCaptcha()

		// remove spaces from the captcha
	    function removeSpaces(string) {
	        return string.split(' ').join('');
	    }//end removeSpaces()
	</script>

</head>
My Form Code (just the captcha element is shown here):

Code:
    <!--START FORM-->
    <form name="inputForm" id="inputForm" method="post" action="thankyou.asp" onsubmit="return validateForm(inputForm);">


	    <!--Start Captcha-->
	    <div style="text-align: center; margin-top: 20px;">
	        <%
	        if Request.ServerVariables("REQUEST_METHOD") = "POST" and IsEmpty(Request.Form("btnRetry")) then
	            Dim lblResult, lblColor
	            if IsEmpty(Session("ASPCAPTCHA")) or Trim(Session("ASPCAPTCHA")) = "" then
	                lblResult = "This test has expired."
	                lblColor = "red"
	            else
	                Dim TestValue : TestValue = Trim(Request.Form("txtCaptcha"))
	                '//Uppercase fix for turkish charset//
	                TestValue = Replace(TestValue, "i", "I", 1, -1, 1)
	                TestValue = Replace(TestValue, "İ", "I", 1, -1, 1)
	                TestValue = Replace(TestValue, "ı", "I", 1, -1, 1)
	                '////////////////////
	                TestValue = UCase(TestValue)
	                
	                if StrComp(TestValue, Trim(Session("ASPCAPTCHA")), 1) = 0 then
	                    lblResult = "CAPTCHA PASSED"
	                    lblColor = "green"
	                else
	                    lblResult = "CAPTCHA FAILED"
	                    lblColor = "red"
	                end if
	                '//IMPORTANT: You must remove session value for security after the CAPTCHA test//
	                Session("ASPCAPTCHA") = vbNullString
	                Session.Contents.Remove("ASPCAPTCHA")
	                '////////////////////
	            end if
	        %>
	        <p><span style="color: <%=lblColor%>; font-weight: bold;"><%=lblResult%></span></p>
	        <input type="submit" name="btnRetry" id="btnRetry" value="Take another test" />
	        <%else%>
	        <img src="captcha.asp" id="imgCaptcha" />&nbsp;<a href="javascript:void(0);" onclick="RefreshImage('imgCaptcha');">New Captcha</a><br />
	        Write the characters in the image above<br />
	        <input type="text" name="txtCaptcha" id="txtCaptcha" value="" /><br />
	        <%end if%>
	    </div>


		<!--Submit Button-->
		<p><button name="submit" type="submit">Submit Your Form</button></p>


    </form>
    <!--END FORM-->