HI all,
I am new to Asp and was surprised at how hard it was for me to figure out how to create a simple form to send an email (compared to PHP).
Anyway I have the form working and the tutorial I used to learn it included validation. But it returns error messages after submission and plops them at the top of the page pushing the entire design down.
I want to either be able to choose where the errors are displayed on the page (Response.Write), or use a simpler JavaScript client side validation before it is submitted.
The form is just for basic contact info, no passwords or anything funky.
Yes I've looked at the code. Its starts like this:
<%
If Action = "SendEmail" Then
' Here we quickly check/validate the information entered
' These checks could easily be improved to look for more things
If IsValidEmail(ContactUs_Email) = "False" Then
IsError = "Yes"
Response.Write("<font color=""red"">You did not enter a valid email address.</font><br>")
End If
then has some more variables, ends the if statements and goes into the body of the message
End If
' If there were no input errors and the action of the form is "SendEMail" we send the email off
If Action = "SendEmail" And IsError <> "Yes" Then
Thanks for the help. I successfully added the error message in the right place, but it appears all of the time. How do I phrase the code so that it only appears if there is an error?
so right now I added to the error check:
If IsValidEmail(ContactUs_Email) = "False" Then
IsError = "Yes"
errmsg = ("<font color=""red"">You did not enter a valid email address.</font><br>")
End If
then under the form field:
<% Response.Write("<font color=""red"" >You did not enter a valid email address.</font><br>") %>
Obviously i don't have a full grasp on asp format, so further help is appreciated.
Bookmarks