Skip to main content
May 17, 2009
Question

contact form - display 'thank you' message

  • May 17, 2009
  • 1 reply
  • 876 views

Could someone tell me how I code an asp contact form to display a 'thank you for your submission' message on the original page.  I don't really want to redirect to totally new pages as I have 3 forms in total with 2 of them on one page.  Ideally I would like to be able to position the thank you messages underneath each of the forms.

I am familiar with response.redirect but not how to display message on the current page.

Many thanks

This topic has been closed for replies.

1 reply

Ken_Ford_-_ACP-QFo4AB
Inspiring
May 18, 2009

Add a hidden form element like this:

<input name="doForm" type="hidden" id="doForm" value="true" />

And add this to the code:

<% 
If Request.Form("doForm") = "true" Then
Dim strMessage
strMessage = "First Name: " & Request.Form("FirstName") & "<br />" &_
"Last Name: " & Request.Form("LastName") & "<br />" &_
"Email: " & Request.Form("Email")
Response.Write(strMessage)
End If
%>


Ken Ford
Adobe Community Expert - Dreamweaver/ColdFusion
Adobe Certified Expert - Dreamweaver CS3
Adobe Certified Expert - ColdFusion 8
Fordwebs, LLC
http://www.fordwebs.com
http://www.cfnoob.com

Message was edited by: Ken Ford - ACE

Participating Frequently
May 18, 2009

To clarify Ken's solution a bit, the idea is to have the form submit back to itself. The asp script then evaluates if the page is being posted to by examining the contents of a hidden field. If the field contains a value, the form submitted it otherwise the page was just opened via url. If the form submitted then you would process the email and display your message.

Frankly, I don't really like the idea of the form being displayed after the user submitted. Most forms on the web don't work this way and is likely to cause confusion. Is there any reason the visitor would want the form to remain displayed after submitted?

May 18, 2009

Many thanks Ken and Bregent for your very helpful answers.

I had thought that it would be better to remain on the contact form but In retrospect, in this instance, I think I will set up a redirect to individual thank you pages.

I will play with your sample code though Ken and learn for the future.

Best wishes