close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

UE-mail not working with ASP Captcha

Thread began 11/22/2011 3:26 pm by Fritz Stickers | Last modified 12/01/2011 2:26 am by Fritz Stickers | 1479 views | 18 replies

Jason ByrnesWebAssist

we're going around in circles. this is still the same exact problem we have been talking about.

lets step back for a moment and talk about forms an how they work, this is the stumbling block causing all of the problems.

[theory]
the form tag tells the server what to do with the data in the form elements when the submit button is pressed.

The method attribute tells the server how to send the form data:

method="post"


sends the data using the Request.Form collection in asp.

the action attribute of the form tag tells the server where to send the form data. this is used to tell the server what page will perform processing on the form:

action="Contact_OK.asp"



using the post method, the Request.Form collection that contains the submitted information will only be available to forms action page while that action page is loading. Once the action page is done loading and is sent to the browser, the request.form collection is destroyed by the server and the form data no longer exists.
[/theory]

on your contact.asp page, your form tag looks like this:

<form action="Contact_OK.asp" method="post" name="Opmerking_Vraag" id="Opmerking_Vraag" onsubmit="MM_validateForm('Naam','','R','Email','','RisEmail','Onderwerp','','R','VraagOpmerking','','R');return document.MM_returnValue">



the method is using post:
method="post"

so the request.form collection is created by the server when the form submits.

the action is set to the Contact_OK.asp page
action="Contact_OK.asp"


Now: this is the important part - the request.form collection that contains the form data is only available to the action page


please read that sentence again:
the request.form collection that contains the form data is only available to the action page.

You have the universal Email behavior code on contact.asp page. but the form does send the request.form collection to that page, so the universal email behavior will not trigger.

you have the captcha code on the Contact_OK.asp page. The action of the form tells the server to send the request.form collection to that page, that is why the captcha works.

Simple Fix:
1) Change the forms action to blank so it will send the request form collection to itself

<form action="" method="post" name="Opmerking_Vraag" id="Opmerking_Vraag" onsubmit="MM_validateForm('Naam','','R','Email','','RisEmail','Onderwerp','','R','VraagOpmerking','','R');return document.MM_returnValue">



2) Move the code for validating captcha from line 2-36 of the Contact_OK.asp page and insert ity at line 2 of the contact.asp page:

<script language=vbscript runat=server>
Sub HDWCaptchaValidation
If (Request.QueryString("hdwtest") = "captchainstalled") Then
Response.Write "Captcha verification code installed."
Response.End
End If
If (Request.ServerVariables("REQUEST_METHOD") = "POST") OR (Request.QueryString.Count >= 4) then
Dim SessionCAPTCHA, CheckCAPTCHA, HDWCaptchaBack, HDWname
SessionCAPTCHA = Trim(CStr(Session("HDWCAPTCHA")))
Session("CAPTCHA") = ""
HDWCaptchaBack = Request.Form("hdwfail")
If (HDWCaptchaBack = "") Then HDWCaptchaBack = Request.QueryString("hdwfail")
For Each HDWname in Request.QueryString
Response.Cookies("hdw" & HDWname) = Request.QueryString(HDWname)
Next
For Each HDWname in Request.Form
Response.Cookies("hdw" & HDWname) = Request.Form(HDWname)
Next
For Each HDWname in Request.Cookies
If (Left(HDWname,3) = "hdw") AND (Request.QueryString(Right(HDWname,Len(HDWname)-3)) = "") AND (Request.Form(Right(HDWname,Len(HDWname)-3)) = "") Then
Response.Cookies(HDWname) = ""
End If
Next
If (Len(SessionCAPTCHA) < 1) OR ((Request.Form("hdcaptcha") = "") AND (Request.QueryString("hdcaptcha") = "")) OR ((SessionCAPTCHA <> CStr(Request.Form("hdcaptcha"))) AND (SessionCAPTCHA <> CStr(Request.QueryString("hdcaptcha")))) Then
Response.Redirect HDWCaptchaBack
Response.End
End If
For Each HDWname in Request.Cookies
If (Left(HDWname,3) = "hdw") Then
Response.Cookies(HDWname) = ""
End If
Next
End If
End Sub
</script>



this way all of the code to process the form, captcha and universal email, are in the same page. more importantly, the page the action attribute tells the server to send the request.form collection.

like i have said in all of my replies in this thread:
All From Processing must occur on the forms action page.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...