<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>assets/js/jquery.validate.js</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -22,26 +22,46 @@ jQuery(document).ready(function ($) {
 		selectFirst: false
 	});
 	
-	$('#search-form').submit(function () {
+	$('#search-form').submit(function (event) {
 	    var $form = $(this);
 
-	    $.ajax({
-	        url: $form.attr('action'),
-	        data: $form.serialize(),
-	        dataType: 'html',
-	        success: function (html) {
-	            $('#search-results').html(html);
-	        },
-	        error: function () {
-	            // console.log(arguments);
-	            // need to push an error in an ARIA alert box
-	        }
-	    })
-	    
-	    return false; 
+        var proceed = true;
+        if (hasWebForms2 &amp;&amp; typeof this.checkValidity == 'function') { // 2nd check should be redundant
+            proceed = this.checkValidity();
+        } else {
+            // FIXME - validator not working...
+            proceed = $form.valid();
+        }
+        
+        // manually build up the inputs since .serialize is skipping over the input[type=datetime_local]
+        var inputs = [];
+        $(':inputs', this).each(function () {
+            if (this.name) {
+                inputs.push(encodeURIComponent(this.name) + '=' + encodeURIComponent(this.value));                
+            }
+        });
+
+        if (proceed) {
+    	    $.ajax({
+    	        url: $form.attr('action'),
+    	        data: inputs.join('&amp;'),
+    	        dataType: 'html',
+    	        success: function (html) {
+    	            $('#search-results').html(html);
+    	        },
+    	        error: function () {
+    	            // console.log(arguments);
+    	            // need to push an error in an ARIA alert box
+    	        }
+    	    });            
+        }
+
+        return false;
 	});
 
     if (!hasWebForms2) {
+        $('#search-form').validate(); // KISS
+        
         $('input.datetime_picker').blur(function () {
     	    var $input = $(this);
     	    var date = Date.parse($input.val());</diff>
      <filename>assets/js/main.js</filename>
    </modified>
    <modified>
      <diff>@@ -38,6 +38,7 @@
 &lt;?php if ($toggles['javascript']) : ?&gt;
 &lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js&quot;&gt;&lt;/script&gt;
 &lt;script src=&quot;assets/js/jquery.autocomplete.js&quot; type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;assets/js/jquery.validate.js&quot; type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
 &lt;script src=&quot;assets/js/date.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
 &lt;script src=&quot;assets/js/main.js&quot; type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
 &lt;?php endif ?&gt;</diff>
      <filename>footer.php</filename>
    </modified>
    <modified>
      <diff>@@ -14,6 +14,8 @@ class Flights {
   function find($from, $to, $date) {
     $flights = array();
     
+    $date = '2009-05-29'; // hard coded to match the flight data
+    
     $date = date('Y-m-j', strtotime($date));
     
     foreach ($this-&gt;flights as $flight) {</diff>
      <filename>lib/flights.php</filename>
    </modified>
    <modified>
      <diff>@@ -35,7 +35,7 @@ $flight_type = array(
     &lt;ul&gt;
       &lt;li&gt;
           &lt;label for=&quot;from-airport&quot;&gt;From:&lt;/label&gt;
-          &lt;input class=&quot;airport-search&quot; id=&quot;from-airport&quot; type=&quot;text&quot; name=&quot;from-airport&quot; placeholder=&quot;airport leaving from&quot; value=&quot;&lt;?php echo $user_data['from-airport']; ?&gt;&quot;&gt;
+          &lt;input class=&quot;required url airport-search&quot; id=&quot;from-airport&quot; required=&quot;true&quot; type=&quot;text&quot; name=&quot;from-airport&quot; placeholder=&quot;airport leaving from&quot; value=&quot;&lt;?php echo $user_data['from-airport']; ?&gt;&quot;&gt;
         &lt;?php
           $airports = $from_airports;
           $type = 'from';
@@ -44,7 +44,7 @@ $flight_type = array(
       &lt;/li&gt;
       &lt;li&gt;
           &lt;label for=&quot;to-airport&quot;&gt;To:&lt;/label&gt;
-          &lt;input class=&quot;airport-search&quot; id=&quot;to-airport&quot; type=&quot;text&quot; name=&quot;to-airport&quot; placeholder=&quot;airport wish to arrive at&quot; value=&quot;&lt;?php echo $user_data['to-airport']; ?&gt;&quot;&gt;
+          &lt;input class=&quot;required airport-search&quot; id=&quot;to-airport&quot; required=&quot;true&quot; type=&quot;text&quot; name=&quot;to-airport&quot; placeholder=&quot;airport wish to arrive at&quot; value=&quot;&lt;?php echo $user_data['to-airport']; ?&gt;&quot;&gt;
         &lt;?php
           $airports = $to_airports;
           $type = 'to';
@@ -53,7 +53,7 @@ $flight_type = array(
       &lt;/li&gt;
       &lt;li&gt;
         &lt;div&gt;&lt;label for=&quot;departure-date&quot;&gt;Departure date &amp;amp; time:&lt;/label&gt;&lt;/div&gt;
-        &lt;div&gt;&lt;input title=&quot;Format: year-month-day hh:mm&quot; class=&quot;datetime_picker&quot; type=&quot;datetime-local&quot; name=&quot;departure-date&quot; placeholder=&quot;year-month-day hh:mm&quot; id=&quot;departure-date&quot; value=&quot;&lt;?php echo $user_data['departure-date']?&gt;&quot;&gt;&lt;/div&gt;
+        &lt;div&gt;&lt;input title=&quot;Format: year-month-day hh:mm&quot; class=&quot;required datetime datetime_picker&quot; required=&quot;true&quot; type=&quot;datetime-local&quot; name=&quot;departure-date&quot; placeholder=&quot;year-month-day hh:mm&quot; id=&quot;departure-date&quot; value=&quot;&lt;?php echo $user_data['departure-date']?&gt;&quot;&gt;&lt;/div&gt;
       &lt;/li&gt;
       &lt;li&gt;
         &lt;p&gt;Number of passengers:&lt;/p&gt;</diff>
      <filename>sidebar.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1c03b4f518a0bed19ad00ca82a0aab9cdb0cbe05</id>
    </parent>
  </parents>
  <author>
    <name>Remy Sharp</name>
    <email>remy@remysharp.com</email>
  </author>
  <url>http://github.com/remy/boxcrateairlines/commit/ce15edcd98a3f787c4c35327e16f7f07d7866fd8</url>
  <id>ce15edcd98a3f787c4c35327e16f7f07d7866fd8</id>
  <committed-date>2009-06-03T01:09:59-07:00</committed-date>
  <authored-date>2009-06-03T01:09:59-07:00</authored-date>
  <message>Adding client side validation</message>
  <tree>60f6748d03067731db0fe665597e9f2c1575ebae</tree>
  <committer>
    <name>Remy Sharp</name>
    <email>remy@remysharp.com</email>
  </committer>
</commit>
