aboutsummaryrefslogtreecommitdiffstats
path: root/www/js
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2013-06-05 14:47:51 +0100
committerStruan Donald <struan@exo.org.uk>2013-06-05 14:47:51 +0100
commit67c68048ed57f3b31093c6cadb820745e64250e6 (patch)
tree5daeeb83b22e497eed8d3aa77e3126d1d7f72b50 /www/js
parent2783aea8198eabd6d60b356695900b62cf763edf (diff)
improve display of error messages and multiple locations on search screen
Diffstat (limited to 'www/js')
-rw-r--r--www/js/views/search.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/www/js/views/search.js b/www/js/views/search.js
index 0cf1de2..c132033 100644
--- a/www/js/views/search.js
+++ b/www/js/views/search.js
@@ -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 );
}
},