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.