i have a validation code in the head section :
<script>
function valid() {
var Form;
Form = document.MyForm;
if (Form.MyField.value.length == 0) {
alert(“The field MyField is required !”);
Form.MyField.focus();
return (false);
}
}
</script>
and an auto-submiting code required to return data from the server:
<SCRIPT LANGUAGE=”JavaScript”>
function do_submit()
{
document.MyForm.action=”<? echo $_SERVER[‘PHP_SELF’];?>”;
document.MyForm.submit();
}
<script>
if i do fill all the required fields and choose any field that calls the do_submit() function, all the fields below these field remain with a value selected (as it was previously filled) but the javascript valid() function, (callled when the submit button is hitted) do the validation for these already filled fields as it was empty but they are not .
How can i fix it? i try to return true at the end of the valid function… window.focus on the do_submit function but it do not work …
thank´s in advance