[thelist] JavaScript Form Validation
Casey Crookston
casey at thecrookstons.com
Wed Jul 16 11:01:56 CDT 2003
This little script works great, except when it hits the form.submit(); line,
and then it returns an error: "Object doesn't support this property or
method." And if I replace
else {
form.submit();
}
with a simple "return true;" then the form never submits. I should also
add, here's the form tag:
response.write " <form name='form' action='fubar.asp' method='post'
onSubmit='simpleCheck(this); return false;'>"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<script language="javascript"><!--
function simpleCheck(form) {
if (form.first_name.value == "") {
alert("Please include a first name");
form.first_name.select();
return false;}
else {
form.submit();
}
}
//--></script>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thanks,
Casey
More information about the thelist
mailing list