- Posts: 85
- Thank you received: 9
Ask the community, share ideas, and connect with other LimeSurvey users!
Please Log in to join the conversation.
Please Log in to join the conversation.
<script src="https://cdn.jsdelivr.net/npm/ip-geolocation-api-jquery-sdk@1.1.0/ipgeolocation.min.js"></script> <script> //Hide the page with JS $('#question{QID}').hide(); // On call to IPGeolocation API on each page during a user's visit, API response will be served from sessionStorage after the first page. _ipgeolocation.enableSessionStorage(true); var ip = sessionStorage.getItem("ip"); var country_name = sessionStorage.getItem("country_name"); var country_code2 = sessionStorage.getItem("country_code2"); var city = sessionStorage.getItem("city"); if (!ip || !country_name || !country_code2 || !city) { _ipgeolocation.makeAsyncCallsToAPI(false); _ipgeolocation.setFields("city,country_name,country_code2"); _ipgeolocation.getGeolocation(handleResponse, "************************************"); } function handleResponse(json) { ip = json.ip; country_name = json.country_name; country_code2 = json.country_code2; city = json.city; } $(document).ready(function(){ var whatiwant = "this is what I want"; $("#answer{SGQ}").val(city+" ,"+country_name+", "+country_code2).trigger('keyup'); }); // Try and auto submit the page $(document).getElementById('#limesurvey').submit(); </script>
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
andAlways run surveys in group-by-group mode so you can hide or combine questions.
This is not a contradiction.to move away from By Group to one question at a time
Please Log in to join the conversation.
Please Log in to join the conversation.
Sorry, then you do something wrong.and adding a new group for every question adds 30 - 60 min build time to each survey.
Right, but the selection of the group in the drop-down after having clicked "Add new question" again is not really time consuming.The ability to add new Q's quickly, with the built in "Add New Q" (in the same group).
Please Log in to join the conversation.
<style> #ls-button-submit { display:none; } #question{QID} { display:none; } </style> <script src="https://cdn.jsdelivr.net/npm/ip-geolocation-api-jquery-sdk@1.1.0/ipgeolocation.min.js"></script> <script> // On call to IPGeolocation API on each page during a user's visit, API response will be served from sessionStorage after the first page. _ipgeolocation.enableSessionStorage(true); var ip = sessionStorage.getItem("ip"); var country_name = sessionStorage.getItem("country_name"); var country_code2 = sessionStorage.getItem("country_code2"); var city = sessionStorage.getItem("city"); if (!ip || !country_name || !country_code2 || !city) { _ipgeolocation.makeAsyncCallsToAPI(false); _ipgeolocation.setFields("city,country_name,country_code2"); _ipgeolocation.getGeolocation(handleResponse, "ENTER_YOUR_OWN_API_KEY_FROM_IPGeolocation.io"); } function handleResponse(json) { ip = json.ip; country_name = json.country_name; country_code2 = json.country_code2; city = json.city; } $(document).ready(function(){ var whatiwant = "this is what I want"; $("#answer{SGQ}").val(city+" ,"+country_name+", "+country_code2).trigger('keyup'); // Remove the next 1 line if you are not using Question by Question Mode as it auto moves to the next question. $('#ls-button-submit').trigger('click'); }); </script>
Please Log in to join the conversation.
<style> /* Hides the Submit button from view*/ #ls-button-submit { display:none; } /* Hides the Question from view*/ #question{QID} { display:none; } </style> <script src="https://cdn.jsdelivr.net/npm/ip-geolocation-api-jquery-sdk@1.1.1/ipgeolocation.min.js"></script> <script> // On call to IPGeolocation API on each page during a user's visit, API response will be served from sessionStorage after the first page. _ipgeolocation.enableSessionStorage(true); var ip = sessionStorage.getItem("ip"); var country_name = sessionStorage.getItem("country_name"); var city = sessionStorage.getItem("city"); var security = sessionStorage.getItem("security"); if (!ip || !country_name || !city) { _ipgeolocation.makeAsyncCallsToAPI(false); // remove following line if not collecting additional security array available in paid for accounts only _ipgeolocation.includeSecurity(true); _ipgeolocation.setFields("city,country_name,security"); _ipgeolocation.getGeolocation(handleResponse, "GET_YOUR_OWN_API_KEY_FROM_HTTPS://IPGEOLOCATION.IO"); } function handleResponse(json) { ip = json.ip; country_name = json.country_name; city = json.city; security = json.security; } // The following adds the data to LS Fields setup as multiple short texts $(document).ready(function(){ $("#answer{SGQ}A1").val(city).trigger('keyup'); $("#answer{SGQ}A2").val(country_name).trigger('keyup'); // remove next 2 lines if not using the additional security array data in paid for accounts. $("#answer{SGQ}A3").val(security.is_proxy).trigger('keyup'); $("#answer{SGQ}A4").val(security.proxy_type).trigger('keyup'); // Auto submit the question once data is loaded $('#ls-button-submit').trigger('click'); }); </script>
Please Log in to join the conversation.