Hi,
Do you want to set textbox widget with process variable?
or, do you want to do calculation in process side? (the example script you gave us look like this)
Assuming first one is correct, there are number of ways to do this.
Each widget has variable and id.
For example if your text widget was labeled "first name", then likely the default value and id will be,
variable
first_name
and
id
id_first_name
Then, if there was the same variable name in process, it will be automatically read into the webform as it opens.
So, 1 idea is to use same variable name between process and widget.
Another one would be, if you write below syntax in Javascirpt widget, it will pre-populate the script with corresponding variable value.
var name = "[[first_name]]";
// double-quotes needed because it is a string value
This case, above script will be written in web interface, JS widget.
The "first_name" is process variable.
Then, if you needed to calculate something and set the number.
You need to know the widget id in web interface.
After the calculation is done, do,
id_widget.setNumber("number_as_string");
Best regards,
Taka