aboutsummaryrefslogtreecommitdiffstats
path: root/web/js
diff options
context:
space:
mode:
Diffstat (limited to 'web/js')
-rw-r--r--web/js/fixmystreet.js20
-rw-r--r--web/js/map-OpenLayers.js3
2 files changed, 23 insertions, 0 deletions
diff --git a/web/js/fixmystreet.js b/web/js/fixmystreet.js
index 6a11a5832..dc180151c 100644
--- a/web/js/fixmystreet.js
+++ b/web/js/fixmystreet.js
@@ -3,6 +3,23 @@
* FixMyStreet JavaScript
*/
+function form_category_onchange() {
+ $.getJSON('/report/new/category_extras', {
+ area_id: 2649,
+ category: this.options[ this.selectedIndex ].text,
+ }, function(data) {
+ if ( data.category_extra ) {
+ if ( $('#category_meta').size() ) {
+ $('#category_meta').html( data.category_extra);
+ } else {
+ $('#form_category_row').after( data.category_extra );
+ }
+ } else {
+ $('#category_meta').empty();
+ }
+ });
+}
+
$(function(){
$('html').removeClass('no-js').addClass('js');
@@ -59,6 +76,9 @@ $(function(){
timer = window.setTimeout(email_alert_close, 2000);
});
+
+ $('#form_category').change( form_category_onchange );
+
// Geolocation
if (geo_position_js.init()) {
$('#postcodeForm').append('<p id="geolocate_para">Or <a href="#" id="geolocate_link">locate me automatically</a>').css({ "padding-bottom": "0.5em" });
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index 0f9974222..dda50b1b9 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -315,6 +315,9 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
}, function(data) {
$('#councils_text').html(data.councils_text);
$('#form_category_row').html(data.category);
+ /* Need to reset this here as it gets removed when we replace
+ the HTML for the dropdown */
+ $('#form_category').change( form_category_onchange );
});
$('#side-form').show();
$('#side').hide();