1

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..

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.