title: Javascript only validates my first input
body: <p>I'm new to Javascript and i'm trying to validate my form, but for some reasons, my code only takes into account the first input.</p>
  
  <p>If I try to insert a 1 char input name, it gives me the correct alert box, but if I insert a 1 char input last name, it doesn't show me the same alert box. </p>
  
  <p>I can't see my mistake...why is it processing only first input? Can anybody help me?</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;form action="registration" name="registrationForm" method="post" onsubmit="return formValidation();"&gt;
      &lt;p&gt; Nome &lt;p&gt;
      &lt;input type="text" class="registrationInput" name="nome" placeholder="Nome" required maxlength="45"/&gt;
      &lt;p&gt; Cognome &lt;/p&gt;
      &lt;input type="text" class="registrationInput" name="cognome" placeholder="Cognome" required maxlength="45"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>JAVASCRIPT</strong></p>
  
  <pre><code>function formValidation(){
  
      var name = document.registrationForm.nome;
      var surname = document.registrationForm.cognome;
  
      if(validateName(name)){
          if(validateSurname(surname)) {
          }
      }
      return false;
  }
  
  function validateName(name){
      if(name.value.length &lt;= 3 || name.value.length &gt;=45) {
          window.alert("Il nome non è corretto. Deve essere lungo da un minimo di 4 a un massimo di 45 caratteri");
          name.focus();
          return false;
      }
      return true;
  }
  
  function validateSurname(surname) {
      if(surname.value.length &lt;= 3 || surname.value.length &gt;=45) {
          window.alert("Il cognome non è corretto. Deve essere lungo da un minimo di 4 a un massimo di 45 caratteri");
          surname.focus();
          return false;
      }
      return true;
  }
  </code></pre>