This page last changed on Nov 12, 2014 by jules_bike.

Has anyone made use of Webview for submitting data?

I am trying out the Sonos Text To Speech functionality and aside from being quite fun to make random announcements around the house - it appears to be quite useful. I've created an html input form and embedded it on a panel. However it seems that when you type in the text and press go on the android keyboard it works every other submit. I can't figure out why.

<html>
<head>
<script type="text/javascript">
var HTTP = {
    request: function (url, callback) {
        var httpRequest = new XMLHttpRequest();
        httpRequest.onreadystatechange = function () {
            if (httpRequest.readyState !== 4) return;
            if (httpRequest.status === 200) {
                // success
                var responseJSON = JSON.parse(httpRequest.responseText);
                callback(responseJSON);
                return;
            }

            throw "Error";
        }
        httpRequest.open("GET", url);
        httpRequest.send(null);
    }
}
 //<input name="Submit"  type="submit" value="Say this" />

 function ExampleJS(){
    var jSay = document.getElementById("say").value;
HTTP.request("http://192.168.0.3:5005/Living%20Room/say/" + jSay, function (res) {});

 }
 </script>

</head>
<body>
    <FORM NAME="myform" onSubmit="JavaScript:ExampleJS()">

<input type="Text" id="say" name="say" autocomplete="off"><br />
              
    </FORM>
</body>
Document generated by Confluence on Jun 05, 2016 09:39