I have a form that is broken out into 4 pages. Dependant on whether you select "Exempt" or "Non-Exempt" on page 3 you will have different choices on page 4.
How can I modify my script so that it only validates the fields that are being displayed.
In this case let's say that only the "Current Salary" field is displayed and validated.
How can I modify my script so that it only validates the fields that are being displayed.
In this case let's say that only the "Current Salary" field is displayed and validated.
Code:
<script type="text/javascript">
function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
{alert(alerttxt);return false}
else {return true}
}
}
function validate_form(thisform)
{
with (thisform)
{
if (validate_required(curr_annual_salary,"CURRENT SALARY must be filled out!")==false)
{curr_annual_salary.focus();return false
}
if (validate_required(new_annual_salary,"NEW ANNUAL SALARY must be filled out!")==false)
{new_annual_salary.focus();return false
}
return true;
}
}
</script>
<form ACTION="<%=MM_editAction%>" name="PAN4" id="PAN4" language="JavaScript" onsubmit="return ( msg() && validate_form(this) );" method="post">