Reputation: 13
I am trying to do simple speech recognition using p5 library.
Why the OnClientClick method is not recognizing/returning the resulted speech. Here is my form code
<form id="form1" runat="server">
<asp:Button ID="iBtnTest" runat="server" OnClientClick="go()" Text="Listen" />
<!-- <input type="button" onclick="go()" value="Listen" -->
</form>
and my javascript code is like this:
let handle = new p5.SpeechRec();
handle.onResult = () => { alert(handle.resultString) }
function go() { handle.start(); }
i have included all the libraries properly and the above code works if i toggle between the simple input which i have commented out.
What am i doing wrong? If this question has already been answered then please give me a link. Thank you..
Upvotes: 1
Views: 3394
Reputation: 402
You must add return methodName() within OnClientClick.
See this and change your JavaScript function as it is.
calling javascript function on OnClientClick event of a Submit button
Upvotes: 1