Welcome to the LimeSurvey Community Forum

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

Restrict Search Place To Map Extent

  • KhemrajC
  • KhemrajC's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
4 years 1 week ago #197115 by KhemrajC
Restrict Search Place To Map Extent was created by KhemrajC
Hi,

In the map display window for openstreetmap, I intend to have the "Restrict Search Place To Map Extent", checked and locked by default.

When it is off, it searches for the whole world. Also, the native search textbox is very slow.

Anyway, I shall have another reactive autocomplete text input in a previous question to better guide the respondent by focusing the map onto his area where he may fine tuned his location. I think this is useful especially when my country is not adequately covered by openstreetmap.

I am trying to tick the checkbox with this function:

<script type="text/javascript" charset="utf-8">

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

function check() {
document.getElementById("restrictToExtent_932887X118X1047").checked = true;
}

});

check();

</script>


And nothing is happening.

What is wrong?


Thanks and regards

Khemraj
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 week ago #197141 by tpartner
Replied by tpartner on topic Restrict Search Place To Map Extent
Try this:

Code:
<script type="text/javascript" charset="utf-8">  
  $(document).on('ready pjax:complete',function() {
    $('#question{QID} input:checkbox[id^="restrictToExtent_"]').prop('checked', true).trigger('change');
  });  
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • KhemrajC
  • KhemrajC's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
4 years 1 week ago #197151 by KhemrajC
Replied by KhemrajC on topic Restrict Search Place To Map Extent
Hi,

I just added that the specific project generated LS ID for the checkbox, 932887X118X1047 and its working!!!

I want to understand the logic behind.

So its using jquery to access DOM.

Any link to the manual to better learn these LS JQuery techniques?

Thanks and regards
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 week ago #197152 by tpartner
Replied by tpartner on topic Restrict Search Place To Map Extent
There is nothing here that is specific to LimeSurvey, it's just jQuery.

- www.w3schools.com/jquery/

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose