K
kurtj
Hello Gurus:
I have a validation script (below) that is somehow messed up. If the
Name field is blank, I get the alert message, then the browser window
goes to a blank document with the word "false" on it. What the ?!?!?!
To test, I commented out the 'return false;' code in the second IF
block, so now if there is a value in Name then I get the alert message
for Email and the page stays put.
What the heck is going on here, and am I doing wrong? BTW, the
"submit" button is a graphic.
<********** START CODE **********>
<script language="JavaScript" type="text/javascript">
<!--
function validate() {
var x = "0";
if (document.subinfo.Name.value == "") {
alert("You must enter your First Name.");
document.subinfo.Name.focus();
x.value = "1";
return(false); }
if (document.subinfo.Email.value == "" ||
document.subinfo.Email.value.indexOf("@") == -1 ||
document.subinfo.Email.value.indexOf(".") == -1) {
alert("Invalid email address. Please re-enter it.");
document.subinfo.Email.focus();
// return false; }
x.value = "1"; }
if (x.value == "0") {
launchwin('thanks.html','confirmation','height=200,width=280');
document.subinfo.submit();
location.href = "default.html"; }
}
-->
</script>
<form action="mailto:[email protected]" id="subinfo" method="post"
name="subinfo" enctype="text/plain">
<input name="Name" size="24" /><br /><br />
<input name="Company" size="24" /><br /><br />
<input name="Email" size="24" /><br /><br />
<textarea name="Comments" cols="38" rows="5"></textarea><br /><br />
<a href="javascript:validate()">
<img src="gfx/send.gif" name="send" width="42" height="18"
alt="Send Form" />
</a>
<a href="javascript:document.inquiries.reset()">
<img src="gfx/clear.gif" name="clear" width="42" height="18"
alt="Clear Form" />
</a>
</form>
<********** END CODE **********>
Thanks,
Kurt
I have a validation script (below) that is somehow messed up. If the
Name field is blank, I get the alert message, then the browser window
goes to a blank document with the word "false" on it. What the ?!?!?!
To test, I commented out the 'return false;' code in the second IF
block, so now if there is a value in Name then I get the alert message
for Email and the page stays put.
What the heck is going on here, and am I doing wrong? BTW, the
"submit" button is a graphic.
<********** START CODE **********>
<script language="JavaScript" type="text/javascript">
<!--
function validate() {
var x = "0";
if (document.subinfo.Name.value == "") {
alert("You must enter your First Name.");
document.subinfo.Name.focus();
x.value = "1";
return(false); }
if (document.subinfo.Email.value == "" ||
document.subinfo.Email.value.indexOf("@") == -1 ||
document.subinfo.Email.value.indexOf(".") == -1) {
alert("Invalid email address. Please re-enter it.");
document.subinfo.Email.focus();
// return false; }
x.value = "1"; }
if (x.value == "0") {
launchwin('thanks.html','confirmation','height=200,width=280');
document.subinfo.submit();
location.href = "default.html"; }
}
-->
</script>
<form action="mailto:[email protected]" id="subinfo" method="post"
name="subinfo" enctype="text/plain">
<input name="Name" size="24" /><br /><br />
<input name="Company" size="24" /><br /><br />
<input name="Email" size="24" /><br /><br />
<textarea name="Comments" cols="38" rows="5"></textarea><br /><br />
<a href="javascript:validate()">
<img src="gfx/send.gif" name="send" width="42" height="18"
alt="Send Form" />
</a>
<a href="javascript:document.inquiries.reset()">
<img src="gfx/clear.gif" name="clear" width="42" height="18"
alt="Clear Form" />
</a>
</form>
<********** END CODE **********>
Thanks,
Kurt