- Posts: 19
- Thank you received: 4
Ask the community, share ideas, and connect with other LimeSurvey users!
Any idea why it works with AJAX on in the other displaymode? The different displaymodes alone are a nice source of bugs.tpartner wrote: The attached sample survey works for me in group-by-group if I disable AJAX mode in the theme options.
<script> function init() { $('#displayCounty').hide(); // Disable the partial-address inputs $('#question{QID} input:text:gt(0)').prop('readonly', true); // Un-comment below to hide the partial-address inputs //$('#question{QID} input:text:gt(0)').hide(); var input = document.getElementById('answer{SID}X{GID}X{QID}SQ001'); var autocomplete = new google.maps.places.Autocomplete(input); autocomplete.addListener('place_changed', function() { var place = autocomplete.getPlace(); var components = place.address_components; if (components) { for (var i = 0, l = components.length; i < l; i++) { var component = components[i]; if (component.types && component.types.indexOf('street_number') !== -1) { $('#answer{SID}X{GID}X{QID}SQ002').val(component.long_name); } if (component.types && component.types.indexOf('route') !== -1) { $('#answer{SID}X{GID}X{QID}SQ003').val(component.long_name); } if (component.types && component.types.indexOf('locality') !== -1) { $('#answer{SID}X{GID}X{QID}SQ004').val(component.long_name); } if (component.types && component.types.indexOf('administrative_area_level_2') !== -1) { $('#displayCounty').text('County: ' + component.long_name); $('#displayCounty').show(); $('#answer{SID}X{GID}X{QID}SQ005').val(component.long_name); } if (component.types && component.types.indexOf('administrative_area_level_1') !== -1) { $('#answer{SID}X{GID}X{QID}SQ006').val(component.long_name); } if (component.types && component.types.indexOf('country') !== -1) { $('#answer{SID}X{GID}X{QID}SQ007').val(component.long_name); } if (component.types && component.types.indexOf('postal_code') !== -1) { $('#answer{SID}X{GID}X{QID}SQ008').val(component.long_name); } $('#answer{SID}X{GID}X{QID}SQ009').val(place.geometry.location.lat(place.address_components.formatted_address)); $('#answer{SID}X{GID}X{QID}SQ010').val(place.geometry.location.lng(place.address_components.formatted_address)); } } }); } google.maps.event.addDomListener(window, 'load', init); </script>