vcstarter
October 1st, 2005, 10:39 PM
This form works fine. I can send email through the form, however the javascript and the vbscrip portion doesnot work. I don't know vbscript and javascript. Can someone fix it for me. The vb part format the email and the user first name and lastname while the javascript part display alerts if the fields are blank.
<html>
<head>
<title>The Speak Logic WebSite</title>
</head>
<body style="text-align: left">
<script language = "vbscript" type="text/vbscript">
Dim firstname, lastname, emailaddress
firstname = Request.Form("FirstName ")
lastname = Request.Form("LastName")
emailaddress = Request.Form("Email")
objMessage.Sender = firstname & " " & lastname & "<" & emailaddress & >"
</script>
<span style="font-size: 24pt; color: #0000ff;">Contact Us</span><br>
<form action = "gdform.asp" method="post">
<strong>First Name:</strong><br>
<input name="FirstName" style="width: 176px" type="text"><br>
<strong>Last Name:</strong><br>
<input name="LastName" style="width: 173px" type="text"><br>
<strong>Email Address:</strong><br>
<input name="Email" style="width: 173px" type="text"><br>
<strong>Subject:</strong><br>
<input name="Subject" style="width: 548px" type="text"><br />
<br>
<strong>Comment:</strong><br>
<textarea name="Comment" style="width: 548px; height: 394px"></textarea><br>
<br>
<input type="submit" value="Submit Form" onclick = "ValidateForm()" style="width: 103px; font-weight: bold;">
<input type="reset" value="Reset" style="font-weight: bold; width: 89px" /><br>
</form>
<script language = "javascript" type="text/javascript">
function ValidateForm()
{
var x;
x = 0
if(info.fn.value==""){
window.alert("Please enter your first name");
x = x + 1;
info.fn.focus();
}
if(info.ln.value==""){
window.alert("Please enter your last name");
x = x + 1;
info.ln.focus();
}
if(info.addr.value==""){
window.alert("Please enter your email address");
x = x + 1;
info.addr.focus();
}
if(info.com.value==""){
window.alert("Please enter your comment name");
x = x + 1;
info.com.focus();
}
if(x==0){document.info.submit()}
}
</script>
</body>
</html>
<html>
<head>
<title>The Speak Logic WebSite</title>
</head>
<body style="text-align: left">
<script language = "vbscript" type="text/vbscript">
Dim firstname, lastname, emailaddress
firstname = Request.Form("FirstName ")
lastname = Request.Form("LastName")
emailaddress = Request.Form("Email")
objMessage.Sender = firstname & " " & lastname & "<" & emailaddress & >"
</script>
<span style="font-size: 24pt; color: #0000ff;">Contact Us</span><br>
<form action = "gdform.asp" method="post">
<strong>First Name:</strong><br>
<input name="FirstName" style="width: 176px" type="text"><br>
<strong>Last Name:</strong><br>
<input name="LastName" style="width: 173px" type="text"><br>
<strong>Email Address:</strong><br>
<input name="Email" style="width: 173px" type="text"><br>
<strong>Subject:</strong><br>
<input name="Subject" style="width: 548px" type="text"><br />
<br>
<strong>Comment:</strong><br>
<textarea name="Comment" style="width: 548px; height: 394px"></textarea><br>
<br>
<input type="submit" value="Submit Form" onclick = "ValidateForm()" style="width: 103px; font-weight: bold;">
<input type="reset" value="Reset" style="font-weight: bold; width: 89px" /><br>
</form>
<script language = "javascript" type="text/javascript">
function ValidateForm()
{
var x;
x = 0
if(info.fn.value==""){
window.alert("Please enter your first name");
x = x + 1;
info.fn.focus();
}
if(info.ln.value==""){
window.alert("Please enter your last name");
x = x + 1;
info.ln.focus();
}
if(info.addr.value==""){
window.alert("Please enter your email address");
x = x + 1;
info.addr.focus();
}
if(info.com.value==""){
window.alert("Please enter your comment name");
x = x + 1;
info.com.focus();
}
if(x==0){document.info.submit()}
}
</script>
</body>
</html>