title: Validation through getElementById()
body: <p>I'm been trying to validate my fields by using 'getElementById()' with '.value'. However, it seems like either getElementById.value is not working or some codes has overlap the function.</p>
  
  <p>Updated Javascript function:</p>
  
  <pre><code>function validate() {
      var Name = document.getElementById('Name').value;
      var Tel = document.getElementById('Tel').value;
      var FaxNo = document.getElementById('FaxNo').value;
      if (Name != "") //wanted to check for alphabets only.
      {
           alert("Correct");
           return true; //doesnt go to next.php
      }
      else 
      {
            alert("Don leave blank!")
            return false;
      }
      if (isNaN(Tel)) //check only numbers. Same code for FaxNo.
      {
          alert("Correct");
          return true; //doesnt go to next.php
      }
      else 
      {
        alert("invalid");
        return false
      }
  
    return true; //doesn't go to next.php
  }
  </code></pre>
  
  <p>My Form:</p>
  
  <pre><code>&lt;Form action ="next.php" method="post"&gt;
  &lt;input name="Name" type="text" id="Name" value=""/&gt;
  &lt;input name="Tel" type="text" id="Tel" value=""/&gt;
  &lt;input name="FaxNo" type="text" id="FaxNo" value=""/&gt;
  &lt;input type="submit" name="submit" onclick="return validate();"/&gt;
  &lt;/Form&gt;
  </code></pre>
  
  <p>I have already defined my onclick function to my Javascript and tried to add return false too. But the alert still cant appear. Kindly advise.</p>