Passing value from javascript to input widget

Passing value from javascript to input widget

  

Hello,

I am working on a speech recognition application. I am trying to get the value of 'myresult' variable from the below javascript to a input widget called 'Input'. The javascript is included in a server action('runJavascript').

I tried using  "document.getElementById(' "+Input.Id+" ').value=response();"  to get the value but it not seems to be working.

How do I solve this issue?

I think your problem is that response() isn't returning a value. Rather it is assigning an event and that even occurs AFTER the response function exits, (the "return myresult" is for "function (event)" not "function response").

Try setting the value from within the event itself, basicaly where you are doing the Alert.