title: Form validation making field required
body: <p>I'm a newbie here, I'm working on a registration form and trying to figure out why I can't make the "Name" field be required. Email and everything else seems to work fine. What am I missing? 
  Thx</p>
  
  <p>this is what I have for the <strong>signup.js</strong> </p>
  
  <pre><code>$(document).ready(function() {
  $("#signup-form").submit(function(e){
      e.preventDefault();
  
      var $form = $(this),
      name = $form.find('input[name="name"]').val(),
      email = $form.find('input[name="email"]').val(),
      url = $form.attr('action');
  
      $.post(url, {name:name, email:email},
        function(data) {
            if(data)
            {
  
              if(data=="Some fields are missing.")
              {
                  $("#status").text("Please fill in your name and email.");
                  $("#status").css("color", "red");
              }
              else if(data=="Invalid name.")
              {
                  $("#status").text("Please fill in your name.");
                  $("#status").css("color", "red");
              }
              else if(data=="Invalid email address.")
              {
                  $("#status").text("Please check your email address.");
                  $("#status").css("color", "red");
              }
              else if(data=="Invalid list ID.")
              {
                  $("#status").text("Your list ID is invalid.");
                  $("#status").css("color", "red");
              }
              else if(data=="Already subscribed.")
              {
                  $("#status").text("You're already subscribed!");
                  $("#status").css("color", "red");
              }
              else
              {
                  $("#status").text("You're subscribed! Please check your email for confirmation.");
                  $("#status").css("color", "green");
              }
            }
            else
            {
              alert("Sorry, unable to subscribe. Please try again later!");
            }
        }
      );
  });
  </code></pre>
  
  <p>});</p>
  
  <p><strong>html</strong> file has this:</p>
  
  <pre><code>&lt;form action="signup.php" method="POST" accept-charset="utf-8" name="signup-form" id="signup-form" class="sign_form" &gt;
  &lt;label for="Silver"&gt;Get Notified&lt;/label&gt;
  &lt;div&gt;
      &lt;input type="text" name="name"  value="" placeholder="Full Name" class="name" /&gt;
      &lt;input type="text" name="email" value="" placeholder="Email" class="email" /&gt;
      &lt;input type="submit"  value="&amp;#x279c;" id="submit-btn" class="submit" /&gt;
  &lt;/div&gt;
  &lt;label id="status"&gt;&lt;/label&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and the <strong>signup.php</strong> file is:</p>
  
  <pre><code>&lt;?php 
  
  $submit_url = 'http://www.domain.com/signup';
  $list = 'list010101';
  
  //POST variables
  $name = $_POST['name'];
  $email = $_POST['email'];
  
  //subscribe
  $postdata = http_build_query(
      array(
      'name' =&gt; $name,
      'email' =&gt; $email,
      'list' =&gt; $list,
      'boolean' =&gt; 'true'
      )
  );
  $opts = array('http' =&gt; array('method'  =&gt; 'POST', 'header'  =&gt; 'Content-type: application/x-www-form-urlencoded', 'content' =&gt; $postdata));
  $context  = stream_context_create($opts);
  $result = file_get_contents($submit_url.'/subscribe', false, $context);
  
  echo $result;
  </code></pre>
  
  <p>?></p>