[JavaScript Demo (How-To)] Getting return values/structures from a Javascript function

[JavaScript Demo (How-To)] Getting return values/structures from a Javascript function

  
Forge Component
(0)
Published on 2015-07-08 by Paulo Ramos
0 votes
Published on 2015-07-08 by Paulo Ramos
How about adding some samples on how to set up output parameters to return values and structures from a Javascript function in an Action?
Hi Taka,

I'm not sure if I understood your scenario, but it seems that you need to:
1. Do some calculations in JavaScript (client-side).
2. Use the result of those calculations inside an action (server-side).

One of the screens in the sample includes this scenario - see here. In this example, the text message is built client-side, submitted to the server via a hidden input (open in Service Studio to see it), and then a Feedback Message is used to simply show the message.

There are other (more sofisticated) ways of achieving this, of course. For example, you expose a REST service, then your JavaScript code can invoke it to send data.