Click to See Complete Forum and Search --> : Validation HELP!


metallicelement
01-21-2004, 10:48 PM
Ok, what I'm trying to do seems simple but I can't find any help on it.

All I do to do is if the user has entered information into one field I want to make sure they have also entered information into another corisponding field and visa-versa.

Its for an exchange process. So if they are requesting 3 of something (3 fields) they must also offer 3 of something (3 fields).

I need help ASAP!!!

vbprog40
01-22-2004, 12:28 AM
Try something along these lines:
<script LANGUAGE="JavaScript">
<!--
function confirmSubmit()
{

if (frm.ex2.value == "" && frm.ex3.value == "") alert=confirm("BOTH FIELDS ARE EMPTY");

else if (frm.ex2.value == "") alert("Please enter field 1");
else if (frm.ex3.value == "") alert("Please enter field 2");
else frm.submit();
}
// -->
</script>

<form name="frm" method="post" action="...">
<input type="text" name="ex2" size="11">
<input type="text" name="ex3" size="11">
<input type="Submit" value="Whatever" name="submit" onClick="confirmSubmit()">
</form>