Hi,
I need to capture a value from javascript code and need to assign it to a variable, how can i achieve the same?
thanks,
Bhuvan
Hi @Bhuvan Chandra Vechalapu ,
Kindly check the OML that you sent to me personally, I've modified it to fit your requirement.
Sandeep.
Hi, this has been answered before, take a look at the solution answer in this post:
https://www.outsystems.com/forums/discussion/40098/how-to-assign-javascript-value-to-out-system-local-variable/
let me know if it was useful!
Cheers,
Paulo
You can use input field to get output from javascript.
What you need to do:
1) Take one input field and name it sometimes like JSoutput.
2) now use this input field id in your javascript code where you can assign your output in innerhtml of input.
3) once you assigned your output in innerhtml of input the variable you are using in input it will be hold output value and you can use it as you want.
Thanks,
Arun
In addition to above answers you can refer below solution if its useful for your usecase.
https://www.outsystems.com/forums/discussion/63166/how-to-bind-the-result-of-javascript-function-in-web-app-to-outsystem-local/
Thanks.
Hi @Bhuvan Chandra Vechalapu,
You can simply do it using Output parameter in JavaScript tool and assign it to you variable
I created a .oml file for you, please check.
read the question carefully before replying, this is a out traditional web. $actions. is only available for reactive web and mobile
you saved me!
Hi Bhuvan,
You have already an action which is used to trigger the JS code.
In my case, the action which will trigger the JS code is "Action_That_Will_Trigger_JS".After triggering this button the output will be saved to the local variable. (To show the value of the variables in UI, I have triggered "Show the output of the JS" this button.)
I am attaching the OML file .Please check it and let me know if you face any difficulty. This solution is for traditional.
Thanks & Regards,
Sudip Pal
Hi @Sudip Pal what is the use of JS that you defined at screen level?
Hi Sandeep,
This is a demo .oml . You need to put JS according to your need then take/store/return the output of the JS like whatever I applied in that demo.