Screen javascript variable to local variable
Question

Hi ,

In container onclick, I have called the function which is defined in the screen javascript editor in traditional web app.

Is it possible to pass the output of the screen javascript to the local variable?


mvp_badge
MVP

Hello,

Usually, we use a hidden input (placed in the OutSystems side) associated with a variable, and when we want to pass the value from JavaScript, we use JavaScript to set the input value. 

When submitting, the variable in OutSystems will have the value.

Cheers.

Hi @Eduardo Jauch!

I'm having the same issue. I'm assigning the value property of my input and I can even see on the browser console the value, but my local variable remains empty. 

document.getElementsByClassName("json_DataHolder-CreateBoQ")[0].value=jsonString;


Any idea as to why this can happen?

Hello,

Eduardo Jauch absolute right as usual!)

A bit more in detail, set hidden style for input and give name to it. Then use in your JS following statement: document.getElementById('"+Input.Id+"').value =YourValue.

If vice versa use the OutSystems variable in JS, then: var JSVar = '" + OutsystemsVar + "'.

Good luck!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.