Hi, I’m trying to validate the fields on my form to make sure that something is entered in each field, I’m not getting picky yet, I just want to make sure they have entered something in each field. For some reason, it isn’t working how I thought it should. Below is my code. If anyone has any suggestions or ideas, I’d greatly appreciate it! Thanks!!!
<script>
function complete()
{
var fname=(document.Payment.Name.value);
var addr=(document.Payment.Address.value);
var city=(document.Payment.City.value);
var state=(document.Payment.State.value);
var zip=(document.Payment.Zip.value);
var phone=(document.Payment.Phone.value);
var DOB=(document.Payment.DOB.value);
var cc=(document.Payment.CC.value);
var ccNum=(document.Payment.CCNum.value);
var month=(document.Payment.ExpMonth.value);
var year=(document.Payment.ExpYear.value);
if(fname ==””)
alert(“hello”);
alert(“Please enter your name.”);
document.Payment.Name.focus();
else
document.Payment.Address.focus();
}
</script>
<FORM name=Payment action=”” method=post>
<TABLE>
<TBODY>
<TR>
<TD><B>Full Name:</B></TD>
<TD><INPUT name=Name></TD></TR>
<TR>
<TD><B>Address:</B></TD>
<TD><INPUT name=Address></TD></TR>
<TR>
<TD><B>City:</B></TD>
<TD><INPUT name=City></TD></TR>
</table>
</form>