diff options
author | Jedidiah Broadbent <hello@jedidiah.eu> | 2013-06-06 11:40:25 +0100 |
---|---|---|
committer | Jedidiah Broadbent <hello@jedidiah.eu> | 2013-06-06 11:40:25 +0100 |
commit | fb5fefe53acea54e742b19f9f7f0a6bf80b89ace (patch) | |
tree | 0625e372559f848ea47c9b405de38739271d6f4f /www/js/views/search.js | |
parent | d66c75606d44d2352e1704e517721bfab1978605 (diff) | |
parent | 71921a7ae6098bfb42451f8a4dee7dc4f45b28c5 (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 | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/www/js/views/search.js b/www/js/views/search.js index 0cf1de2..9e0a4ca 100644 --- a/www/js/views/search.js +++ b/www/js/views/search.js @@ -5,9 +5,9 @@ id: 'search-page', events: { - 'click a.address': 'goAddress', - 'click #submit': 'search', - 'click #locate': 'goLocate', + 'vclick a.address': 'goAddress', + 'vclick #submit': 'search', + 'vclick #locate': 'goLocate', 'pagehide': 'destroy', 'pagebeforeshow': 'beforeDisplay', 'pageshow': 'afterDisplay', @@ -23,6 +23,7 @@ search: function(e) { // this is to stop form submission e.preventDefault(); + this.clearValidationErrors(); var pc = this.$('#pc').val(); this.listenTo(FMS.locator, 'search_located', this.searchSuccess ); this.listenTo(FMS.locator, 'search_failed', this.searchFail); @@ -51,7 +52,7 @@ $('#submit').focus(); this.stopListening(FMS.locator); if ( details.msg ) { - this.displayError( details.msg ); + this.validationError( 'pc', details.msg ); } else if ( details.locations ) { var multiple = ''; for ( var i = 0; i < details.locations.length; i++ ) { @@ -59,9 +60,9 @@ var li = '<li><a class="address" id="location_' + i + '" data-lat="' + loc.lat + '" data-long="' + loc.long + '">' + loc.address + '</a></li>'; multiple = multiple + li; } - $('#front-howto').html('<ul>' + multiple + '</ul>'); + $('#front-howto').html('<p>Multiple matches found</p><ul>' + multiple + '</ul>'); } else { - this.displayError( FMS.strings.location_problem ); + this.validationError( 'pc', FMS.strings.location_problem ); } }, |