Snoey
07-06-2011, 03:38 PM
New to javascript...I'm looking to see if:
1. Is there is a better way to do this? Is this a good way or is there something else I should be doing?
2. I have 8 different fields I have to pair up and check all in sequential order. Example, checking earnings_work1 to earnings_work_occur1, checking earnings_work2 to earnings_work_occur2, etc. Do I need to repeat the script below 8 times or where should I be heading?
<SCRIPT LANGUAGE="JavaScript">
function validateForm()
{
if (form1.earnings_work1.value.length != 0)
{
if (form1.earnings_work_occur1.value.length == 0) {
alert("You must enter an occurence.");
return (false);
}
}
}
// End -->
</script>
1. Is there is a better way to do this? Is this a good way or is there something else I should be doing?
2. I have 8 different fields I have to pair up and check all in sequential order. Example, checking earnings_work1 to earnings_work_occur1, checking earnings_work2 to earnings_work_occur2, etc. Do I need to repeat the script below 8 times or where should I be heading?
<SCRIPT LANGUAGE="JavaScript">
function validateForm()
{
if (form1.earnings_work1.value.length != 0)
{
if (form1.earnings_work_occur1.value.length == 0) {
alert("You must enter an occurence.");
return (false);
}
}
}
// End -->
</script>