How to set a TextBox visibility based on internet connection status?

0
Hello,   I would like to set the visibilty of my textBox based on the user connection status. If the user has a connection, the textBox is Hidden, if he does not have one, the textBox is visible.   I will be grateful for any help.
asked
1 answers
0

You can use the following Javascript to achieve it, place the Javascript Snippet Widget below the input field with the following code:

 

const refreshTime = 5; // in secs

const inputName = 'text8'; // Widget Common Name (Element Name) 

setInterval(function() {var hostChecker = $.get("https://networkconnectivity.googleapis.com/$discovery/rest?version=v1", function() {$('.mx-name-' + inputName + ' input')[0].disabled = false;}).fail(function() {$('.mx-name-' + inputName + ' input')[0].disabled = true;})}, refreshTime * 1000);

 

 

Uses Google Network Connectivity API to check internet connection.

answered