title: Partial validation executed
body: <p>I am trying to do few validations in a form and it is not up to the mark. I need to hide the error message message of the name and show only email error. But it is not happening. Maybe you will understand from the code.</p>
  
  <p>Here it is.</p>
  
  <pre><code>function validateform(form){ 
   event.preventDefault();
   console.log(form);
   var i; 
   var fname = form.name.value;
   var email = form.email.value;
   var message = form.getElementsByClassName("error-message");
   var atpos = email.indexOf("@");
   var dotpos = email.lastIndexOf(".");
   if (fname==null || fname==""){      
     for (i = 0; i &lt; message.length;i++)
     {
       form.getElementsByClassName("error-message")[i].innerHTML="Please Enter Name";
    return false;
    }  
  }
  
   else if (atpos&lt;1 || dotpos&lt;atpos+2 || dotpos+2&gt;=email.length) {
   for (i = 0; i &lt; message.length;i++)
   {
    form.getElementsByClassName("error-email")[i].innerHTML="The email address you've entered contains an incorrect character. Please check this information and try again.";
    return false;
   } 
  }
  
  else if (fname!=null || fname!=""){
  for (i = 0; i &lt; message.length;i++)
   {
    form.getElementsByClassName("error-message")[i].style.display = "none";
    return false;
   }
  }
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>    &lt;form name="ccform" method="post" onsubmit="validateform(this)"&gt;
              &lt;p class="customer-name"&gt;Name&lt;/p&gt;
              &lt;input type="text" class="input-name" name="name"&gt;&lt;/input&gt;
              &lt;p class="error-message"&gt;&lt;/p&gt;
              &lt;p class="customer-name"&gt;Email&lt;/p&gt;
              &lt;input type="text" class="input-name" name="email" placeholder="e.g. name@emailaddress.com"&gt;&lt;/input&gt;
              &lt;p class="error-email"&gt;&lt;/p&gt;
              &lt;button type="submit" class="submit-button"&gt;Submit&lt;/button&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>I want to hide error-message and show only error-email when name is entered,email is not entered and i press submit button.</p>
  
  <p>P.S: Please no jQuery.</p>