Hitting enter while in the location field shouldn't submit the form.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Thu, 15 Apr 2010 21:11:04 +0000 (17:11 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Thu, 15 Apr 2010 21:12:25 +0000 (17:12 -0400)
Catch KEY_RETURN in the keydownHandler, and trigger the geocode action if
we are in the location field of the event form.

kronolith/js/kronolith.js

index bc0c36a..1ed244e 100644 (file)
@@ -3261,7 +3261,14 @@ KronolithCore = {
     keydownHandler: function(e)
     {
         var kc = e.keyCode || e.charCode,
-            form = e.findElement('FORM');
+            form = e.findElement('FORM'), trigger = e.findElement();
+
+        if (trigger.id == 'kronolithEventLocation' && kc == Event.KEY_RETURN) {
+            this.ensureMap();
+            this.geocode($F('kronolithEventLocation'));
+            e.stop();
+            return;
+        }
 
         if (form) {
             switch (kc) {