woodywyatt
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by woodywyatt
-
-
The script tag is the only thing that outputs the error alert. I did have it working fine until I was told by my hosting company to upgrade to Windows 2008 server. The only thing that changed was the send mail code from cdonts to cdosys.
-
I’m trying to get the JavaScript Alert to pop up on this mail form script but it just displays a blank page. It submits the form contents fine when the correct spam code is entered.Can anyone tell me what I need to change in the code in order for the JavaScript Alert to pop work?Actual form is here just in case you need to see it in action - rockislandbar.com/formtest.html
<% ' Define the used variables Dim verCode ' Retrieve the form data verCode = Request.Form("verCode") ' Check if the entered code is the actual code If isCode(verCode) then If Request.Form("submit") <> "" ThenSet myMail=CreateObject("CDO.Message")myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.myhost.co.uk"myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = ""myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = ""myMail.Configuration.Fields.UpdatemyMail.Subject= "Contact Us From Website" 'This is the subject of the e-mailmyMail.To="my email@mysite.com" 'This is the e-mail address the e-mail will be delivered tomyMail.From=Request.Form("emaddress")myMail.TextBody="Name: " & Request.Form("name") & vbnewline & "E-Mail Address: " & Request.Form("emaddress") & vbnewline & "Message: " & Request.Form("message")myMail.Sendset myMail=nothingResponse.Redirect("thankyou.asp")Else 'Error output%><script language="javascript"><!--window.alert ("It looks like you entered the wrong code rnTry again or click 'Reload for another image' under the image.");window.history.go(-1);//--></script><% End If %> <% ' Function to check if the sent code is the actual verification code Function isCode(enteredCode) ' Check if the entered code in caps is same as the session code (which is in caps) if UCase(enteredCode) = Session("image_ver") then ' Return true isCode = true else 'Return False isCode = false end if End Function End If%>
Mail form script Alert - error
in ASP
Posted
No worries, I've fixed it. Moved the Javascript code down to the end of the code:<% ' Function to check if the sent code is the actual verification code Function isCode(enteredCode) ' Check if the entered code in caps is same as the session code (which is in caps) if UCase(enteredCode) = Session("image_ver") then ' Return true isCode = true else %><script language="javascript"> <!-- window.alert ("It looks like you entered the wrong code rnTry again or click 'Reload for another image' under the image."); window.history.go(-1); //--> </script><% 'Return False isCode = false end if End Function End If%>