aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2016-03-02 12:09:26 +0000
committerDave Arter <davea@mysociety.org>2016-03-29 17:24:40 +0100
commitdedeb93becf9fc5b6cdb05972f3fcd7064678164 (patch)
tree2dbd8d32b7bb479a6baba1a5a4dd0842760ebd35
parent65d2c1c4ddaf75465cc92e0d584d8e9a106fd02b (diff)
Preserve category when clicking elsewhere on map
Because the list of categories is reloaded when changing the location of an in-progress report, it was possible for the category the user had selected to be un-selected. This improves the situation by re-selecting that category if it appears in the new list.
-rw-r--r--web/js/map-OpenLayers.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index cc4959b7b..f6c446f7b 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -21,8 +21,12 @@ function fixmystreet_update_pin(lonlat) {
return;
}
$('#side-form, #site-logo').show();
+ var old_category = $("select#form_category").val();
$('#councils_text').html(data.councils_text);
$('#form_category_row').html(data.category);
+ if ($("select#form_category option[value=\""+old_category+"\"]").length) {
+ $("select#form_category").val(old_category);
+ }
if ( data.extra_name_info && !$('#form_fms_extra_title').length ) {
// there might be a first name field on some cobrands
var lb = $('#form_first_name').prev();