diff options
author | Jedidiah Broadbent <hello@jedidiah.eu> | 2013-06-05 12:21:48 +0100 |
---|---|---|
committer | Jedidiah Broadbent <hello@jedidiah.eu> | 2013-06-05 12:21:48 +0100 |
commit | d66c75606d44d2352e1704e517721bfab1978605 (patch) | |
tree | eb305905cd17e0b787653871e6b4392015e39240 /www/js/views/search.js | |
parent | 00935ce1da08124918becbe6b2d97d3b6703dc5c (diff) | |
parent | 2783aea8198eabd6d60b356695900b62cf763edf (diff) |
Merge branch 'phonegap-jquery-mobile-new' of ssh://git.mysociety.org/data/git/public/fixmystreet into phonegap-jquery-mobile-new
Diffstat (limited to 'www/js/views/search.js')
-rw-r--r-- | www/js/views/search.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/www/js/views/search.js b/www/js/views/search.js index b506884..0cf1de2 100644 --- a/www/js/views/search.js +++ b/www/js/views/search.js @@ -10,7 +10,8 @@ 'click #locate': 'goLocate', 'pagehide': 'destroy', 'pagebeforeshow': 'beforeDisplay', - 'pageshow': 'afterDisplay' + 'pageshow': 'afterDisplay', + 'submit #postcodeForm': 'search' }, afterDisplay: function() { @@ -19,7 +20,9 @@ } }, - search: function() { + search: function(e) { + // this is to stop form submission + e.preventDefault(); var pc = this.$('#pc').val(); this.listenTo(FMS.locator, 'search_located', this.searchSuccess ); this.listenTo(FMS.locator, 'search_failed', this.searchFail); @@ -44,6 +47,8 @@ }, searchFail: function( details ) { + // this makes sure any onscreen keyboard is dismissed + $('#submit').focus(); this.stopListening(FMS.locator); if ( details.msg ) { this.displayError( details.msg ); @@ -65,7 +70,7 @@ this.navigate( 'around' ); }, - destroy: function() { + _destroy: function() { delete FMS.searchMessage; this.stopListening(FMS.locator); } |