This is the code and "fields" is the tag I'm having an issue with since I don't want it to show when the user clicks submit if all the fields are valid:
// JavaScript Document function CheckTheForm() {
var result = true;
var msg="";
document.getElementById('idmail').style.display="none"; document.getElementById('fields').style.display="none"; document.getElementById('First').style.color='#000000'; document.getElementById('maincontactemail').style.color='#000000'; document.getElementById('Last').style.color='#000000'; document.getElementById('refcode').style.color='#000000';
if (document.validate.First.value.length < 3) {
document.validate.First.focus();
document.getElementById('First').style.color="#FF3333";
result = false;
}
if (document.validate.Last.value.length < 3) {
document.validate.Last.focus();
document.getElementById('Last').style.color="#FF3333";
result = false;
}
if (document.validate.Last.value.length < 3) {
document.validate.Last.focus();
document.getElementById('Last').style.color="#FF3333";
result = false;
}
if (document.validate.refcode.value.length < 3) {
document.validate.refcode.focus();
document.getElementById('refcode').style.color="#FF3333";
result = false;
}
if (document.validate.maincontactemail.value.length < 7) {
document.validate.maincontactemail.focus();
document.getElementById('maincontactemail').style.color="#FF3333";
result = false;
}
var emailID=document.validate.maincontactemail
if ((emailID.value==null)||(emailID.value=="")){
document.validate.maincontactemail.focus();
document.getElementById('maincontactemail').style.color="#FF3333";
result = false;
}
if ((echeck(emailID.value)==false) && (emailID.value!='')){
document.validate.maincontactemail.focus();
document.getElementById('maincontactemail').style.color="#FF3333";
document.getElementById('idmail').style.display="block";
result = false;
}
if(msg==""){
document.getElementById('fields').style.display="block";
return result;
}{
alert(msg)
return result;
}
if(msg==""){
return result;
}{
alert(msg)
return result;
}
}