aboutsummaryrefslogtreecommitdiffstats
path: root/www/js/views/search.js
diff options
context:
space:
mode:
authorJedidiah Broadbent <hello@jedidiah.eu>2013-06-05 12:21:48 +0100
committerJedidiah Broadbent <hello@jedidiah.eu>2013-06-05 12:21:48 +0100
commitd66c75606d44d2352e1704e517721bfab1978605 (patch)
treeeb305905cd17e0b787653871e6b4392015e39240 /www/js/views/search.js
parent00935ce1da08124918becbe6b2d97d3b6703dc5c (diff)
parent2783aea8198eabd6d60b356695900b62cf763edf (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.js11
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);
}