L
LRW
I'm trying to get the script to alert you of certain blank fields when
you submit the form, but it just doesn't work, and I can't see why. By
all appearances it should be working.
But I get no errors, and then you SUBMIT it just goes right on to the
next page completely bypassing the validation.
What am I doing wrong? What am I missing?
If someone could give me a clue, I'd appreciate it!
Below is the JS and the relavent parts of the form.
Thanks!!
Liam
<script language=JavaScript>
<!-- Begin
function ValidateE1() {
var FieldList = "";
if (document.f1.toemail.value.length < 2 ){
FieldList = "To Email\n";
}
if (document.f1.fromemail.value == "") {
FieldList = FieldList + "From Email\n";
}
if (document.f1.msg.value == "") {
FieldList = FieldList + "Message\n";
}
if (FieldList != "") {
alert("We did not get all the information we need from you.\n\n
Please fill in the following field(s):\n\n" + FieldList);
return false;
} else {
document.f1.submit();
}
}
// End -->
</script>
--SNIP--
<form name="f1" id="f1" method="post" action="emailerproc.bkk"
onSubmit="return ValidateE1();" >
--SNIP--
<td valign="top"><input name="toemail" id="toemail" type="text"
size="40">
<span class="labelBlue"><br>^-- Recipient's E-mail
address</span> </td>
--SNIP--
you submit the form, but it just doesn't work, and I can't see why. By
all appearances it should be working.
But I get no errors, and then you SUBMIT it just goes right on to the
next page completely bypassing the validation.
What am I doing wrong? What am I missing?
If someone could give me a clue, I'd appreciate it!
Below is the JS and the relavent parts of the form.
Thanks!!
Liam
<script language=JavaScript>
<!-- Begin
function ValidateE1() {
var FieldList = "";
if (document.f1.toemail.value.length < 2 ){
FieldList = "To Email\n";
}
if (document.f1.fromemail.value == "") {
FieldList = FieldList + "From Email\n";
}
if (document.f1.msg.value == "") {
FieldList = FieldList + "Message\n";
}
if (FieldList != "") {
alert("We did not get all the information we need from you.\n\n
Please fill in the following field(s):\n\n" + FieldList);
return false;
} else {
document.f1.submit();
}
}
// End -->
</script>
--SNIP--
<form name="f1" id="f1" method="post" action="emailerproc.bkk"
onSubmit="return ValidateE1();" >
--SNIP--
<td valign="top"><input name="toemail" id="toemail" type="text"
size="40">
<span class="labelBlue"><br>^-- Recipient's E-mail
address</span> </td>
--SNIP--