Hi all,
Im trying to, deal with a problem that drives me crazy!
Im useing the following code to chech the fields of a form before
really submitting them:
-------
<script language="JAVASCRIPT">
function CheckForm()
{
var f = document.register;
var error_mes = '';
var submitOK="True";
if (f.place.value.length < 3)
{
error_mes = error_mes + "\n - No place.";
SubmitOK = "False";
}
if (f.provi.options[f.provi.value].value == 0)
{
error_mes = error_mes + "\n - No province.";
SubmitOK = "False";
}
if (f.educa.options[f.educa.value].value == 0)
{
error_mes = error_mes + "\n - No education.";
SubmitOK = "False";
}
if (f.prof.value.length == ' ')
{
error_mes = error_mes + "\n - No profession.";
SubmitOK = "False";
}
if (f.civil.options[f.civil.value].value == 0)
{
error_mes = error_mes + "\n - No civil.";
SubmitOK = "False";
}
if (f.pass.value.length == ' ')
{
error_mes = error_mes + "\n - No password.";
SubmitOK = "False";
}
if (f.pass.value != f.pass_ch.value)
{
error_mes = error_mes + "\n - No password check.";
SubmitOK = "False";
}
if (f.email_1.value.length < 4)
{
error_mes = error_mes + "\n - No e-mail.";
SubmitOK = "False";
}
if (f.email_1.value != f.email_2.value)
{
error_mes = error_mes + "\n - No e-mail check.";
SubmitOK = "False";
}
if (SubmitOK=="False")
{
alert(error_mes);
return false
}
}
</script>
---------
When i leave all the field empty and don't use the dropdown-boxes,
everything works fine; I get an error message and the form is not
submitted. But when i enter text or use the first three or four field
and leave the others blank, i don't get an errormessage and the data
is submitted.
Can anyone tell me how to deal with it??
Thanx!!
WJ