title: Student Registration Form Validation in JavaScript
body: <p>I have been working on a student registration form validation in JavaScript but it doesn't work at all. I have even tried writing all sorts of log statements for debugging but it seems the functions aren't being invoked at all(?). </p>
  
  <p>It'd be helpful if you guys could let me know where I am going wrong with this. 
  Here is the code :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  
   &lt;head&gt;
    &lt;script type="text/javascript"&gt;
     function allLetter() {
      var name = document.querySelector("#name").value;
  
      var letters = /^[A-Za-z]*$/;
      if (name.test(letters)) {
       return true;
      } else {
       alert("Not a valid Name");
       return false;
      }
     }
  
     function rollnumber() {
      var roll = document.querySelector("#roll").value;
  
      var phoneno = /^\d{7}$/;
      if (roll.test(phoneno)) {
       return true;
      } else {
       alert("Not a valid Roll Number");
       return false;
      }
     }
  
     function date() {
      var date = document.querySelector("#date").value;
  
      if (!date) {
       return true;
      }
      else {
       alert("Empty Date");
       return false;
      }
     }
  
     function check() {
  
      var t1 = allLetter();
      var t2 = rollnumber();
      var t3 = date();
  
      console.log(t1);
      console.log(t2);
      console.log(t3);
  
      if (t1 &amp;&amp; t2 &amp;&amp; t3) {
       alert("Registration Successful");
       return true;
      } else {
       alert("One or More Fields are incorrectly set");
       return false;
      }
     }
    &lt;/script&gt;
   &lt;/head&gt;
  
   &lt;body&gt;
  
    &lt;h2&gt;STUDENT REGISTRATION FORM&lt;/h2&gt;
  
    &lt;form name="form1" method="post" onsubmit="return check()"&gt;
     &lt;label for="name"&gt;Name :&lt;/label&gt;
     &lt;input type="text" id="name"&gt;&lt;br&gt;
  
     &lt;label for="roll"&gt;Roll No :&lt;/label&gt;
     &lt;input type="text" id="roll"&gt;&lt;br&gt;
  
     &lt;label for="date"&gt;DOB :&lt;/label&gt;
     &lt;input type="date" id="date"&gt;&lt;br&gt;
  
     &lt;input type="submit" value="Register"&gt;
    &lt;/form&gt;
  
   &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>