How to change textinput with javascript

Hi

I am trying to create and app that will create a best fit line through a series of points. I am making the tool interact so I can change the slope and intercept as needed. I would like to have the error posted to a text box of some sort so I can see the changes as I move the bestfit line with sliders. Is there a way to set the value of a textinput widget to there error number within a javascript callback?

I want to do it with javascript to create a standalone app.

Darren