Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

pregunta google maps

  • javierlca
  • javierlca's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 9 months ago #200339 by javierlca
pregunta google maps was created by javierlca
Hola, estoy usando el siguiente script para una pregunta de gps en la que necesito obtener ubicación actual el script funciona bien pero el marcador no cambia a la ubicación actual para poder confirmar que se esté tomando bien mi ubicación actual, me podrían ayudar por favor.

<p>Ubicación.</p>
<button class="gpsLink" type="button">Obtener Ubicación</button>
<script type="text/javascript" charset="utf-8">

$(document).on('ready pjax:scriptcomplete',function(){

// Identify this question
var q1ID = '{QID}';
var q1 = $('#question'+q1ID);

// Click event for the button
$('.gpsLink').click(function(){
getGPS();
});

function getGPS() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showGPS, gpsError);
} else {
$('input.text', q1).val('No GPS Functionality');
$('input:hidden[id^="answer"]', q1).val('No GPS Functionality');
}
}

function gpsError(error) {
alert('GPS Error: '+error.code+', '+error.message);
}

function showGPS(position) {
$('input.text', q1).val(position.coords.latitude+', '+position.coords.longitude);
$('input:hidden[id^="answer"]', q1).val(position.coords.latitude+';'+position.coords.longitude);
}

});
</script>

Saludos
The topic has been locked.
  • gabrieljenik
  • gabrieljenik's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
3 years 9 months ago #200345 by gabrieljenik
Replied by gabrieljenik on topic pregunta google maps
Hola,


En la función getGPS, necesitas actualizar no solo el campo de texto, sino también el mapa, no?


Saludos

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Checkout our Reporting Solutions and our plugin shop at www.encuesta.biz .

The topic has been locked.
  • javierlca
  • javierlca's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 9 months ago #200347 by javierlca
Replied by javierlca on topic pregunta google maps
Si, es justo lo que necesito, si por favor me puedes ayudar te agradecería
The topic has been locked.
  • javierlca
  • javierlca's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 9 months ago #200348 by javierlca
Replied by javierlca on topic pregunta google maps
Si, es justo lo que necesito, si por favor me puedes ayudar te agradecería
The topic has been locked.
  • gabrieljenik
  • gabrieljenik's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
3 years 9 months ago #200433 by gabrieljenik
Replied by gabrieljenik on topic pregunta google maps
Me envías un poco más de información de tu pregunta? Una exportación lsq?

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Checkout our Reporting Solutions and our plugin shop at www.encuesta.biz .

The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose