title: html javascript php zip code data validation
body: <p>I am adding a data validation to my code. I want to make sure the event title is not blank, and the zip code entered is valid. The javascript does not work. Can you tell me why?</p>
  
  <pre><code>&lt;form name="form1" action="organize.php" onSubmit="return validateform1();" method="post" enctype="multipart/form-data"&gt;            
  
      &lt;div class="form-element"&gt;
          &lt;label for="event_title"&gt;Event Title&lt;/label&gt;
          &lt;input type="text" name="event_title" id="dob" /&gt;
      &lt;/div&gt;
  
      &lt;div class="form-element"&gt;
          &lt;label for="zip"&gt;Zip Code&lt;/label&gt;
          &lt;input type="text" name="zip" id="dob" /&gt;
      &lt;/div&gt;
  
      &lt;script language="javascript"&gt;
  
          function validateform1(){        
  
              var zipcode = /^\+?([0-9]{2})\)?[-. ]?([0-9]{4})[-. ]?([0-9]{4})$/;        
              if(document.form1.event_title.value==""){
                  alert("Enter a title");
                  return false;
              }        
              else if((!document.form1.zip.value.match(zipcode)){  
                  alert("wrong zip format");  
                  return false;  
              }  
      &lt;/script&gt;
  
  &lt;/form&gt;
  </code></pre>