J
jr
Something is not working on the validation script. The bu is
required in a search form. Zonenm and zoneid are required together.
If someone searches on a bu and also a zoneid, then they must also
search on the zonenm and vice versa.So it is either all 3 or just the
bu. The bu validation always works. HOwever if I search on bu and
zoneid for example, I get a message asking for zonenm, but
alternatively, if I ask for the zoneid and bu, it should ask for the
zonenm. I tried it with the 3rd else if as an else instead of else if
but then I got a syntax error. thanks,
<script type="text/javascript">
function checkscript() {
var ele = document.forms[0].elements;
if (!ele.search_bu.value) {
alert('The Business Unit is a required field!');
return false;
} else if (ele.search_zoneid.value && !ele.search_zonenm.value) {
alert('Zone ID but no zone number');
return false;
} else if(ele.search_zonenm.value && !ele.search_zoneid.value) {
alert('Zone Number but no zone id');
return false;
}
return true;
}
</script>
required in a search form. Zonenm and zoneid are required together.
If someone searches on a bu and also a zoneid, then they must also
search on the zonenm and vice versa.So it is either all 3 or just the
bu. The bu validation always works. HOwever if I search on bu and
zoneid for example, I get a message asking for zonenm, but
alternatively, if I ask for the zoneid and bu, it should ask for the
zonenm. I tried it with the 3rd else if as an else instead of else if
but then I got a syntax error. thanks,
<script type="text/javascript">
function checkscript() {
var ele = document.forms[0].elements;
if (!ele.search_bu.value) {
alert('The Business Unit is a required field!');
return false;
} else if (ele.search_zoneid.value && !ele.search_zonenm.value) {
alert('Zone ID but no zone number');
return false;
} else if(ele.search_zonenm.value && !ele.search_zoneid.value) {
alert('Zone Number but no zone id');
return false;
}
return true;
}
</script>