form inside a div
am 17.09.2007 22:55:28 von jp2codeI have some Classic ASP script that is not working at all. By that, I mean
that none of the code seems to execute.
I have the exact same code in another form on another web page, and it does
work.
The only difference between the two that I can see (other than username and
password fields) is that the non-working page contains a form within a div
tag, whereas the working page places the form inside a table.
The form's id is "contact" on both pages.
The div's id is "popup" on the non-working page.
The table on the working page does not use an id.
Have I used a reserved word somewhere?
Can a form with an id be nested within another tag that also has an id?
There are no errors. When the form is submitted, the information should be
validated in the script, but instead I get what looks like the page being
reloaded without its previous values.
I am typically a C++ guy, so it is very possible that I have missed or
overlooked something very basic - but it wasn't the username and password!
I've checked them multiple times.
Thanks in advance!
~Joe
Below is the non-functional version's code:
<%@ Language="VBSCRIPT"%>
"http://www.w3.org/TR/html4/strict.dtd">
<%
Dim OK
Dim str1Err, str2Err, str3Err, str4Err
Dim strFirst, strLast, strEmail, strMyMessage
Dim strWriteMsg, strEmailValidator, strHtmlBody
OK = True
str1Err = ""
str2Err = ""
str3Err = ""
str4Err = ""
strMyMessage = ""
strWriteMsg = "Write your message here."
strEmailValidator =
"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} \.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"
If (Request.Form("5submit") = "Send") Then
strFirst = Request.Form("1FirstName")
If (strFirst = "") Then
str1Err = "Required"
OK = False
End If
strLast = Request.Form("2LastName")
If (strLast = "") Then
str2Err = "Required"
OK = False
End If
strEmail = Request.Form("3Email")
Set regEx = New RegExp
regEx.Pattern = "^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w{2,}$"
If (regEx.Test(Trim(strEmail)) = False) Then
str3Err = "Incorrect format"
OK = False
End If
Set regEx = Nothing
strMyMessage = Request.Form("4Message")
If (strMyMessage = "") Or (strMyMessage = strWriteMsg) Then
str4Err = "Required"
OK = False
Else
strWiteMsg = ""
End If
If (OK = True) Then
Dim strFrom
strFrom = strFirst & " " & strLast & " <" & strEmail & ">"
Set objMessage = CreateObject("CDO.Message")
strHtmlBody = "