Hello Everyone
I am working on survey 123 connect 3.14. I want to create a survey form based on the online / offline mode. in my excel sheet some question are based on online and some on online.
I want to my survey app auto detect the mode either online or offline and based on this auto switches the question also.
For Example:- suppose I have a choice type question in the survey named Survey Mode, If I am in the internet connectivity then automatically select the online mode or if I am not in network then automatically select the offline mode.
see attached screenshot. Hope this helps.
Solved! Go to Solution.
Hi DeonLengton,
The script is pretty good and working fine.
Thanks for your quick response.
Hi Sunita
Hopefully your survey isnt publicly shared, because then you could use an http call in a Javascript function to determine if your survey has connectivity or not...
This seems to work:
function doOnlineCheck() {
var xmlhttp = new XMLHttpRequest();
var response;
var url = "https://www.google.com";
xmlhttp.open("GET",url,false);
xmlhttp.send();
if (xmlhttp.status === 200) {
return "Online";
}
return "Offline";
}
Hi DeonLengton,
The script is pretty good and working fine.
Thanks for your quick response.