375
Views
4
Comments
Getting a Parameter from jQuery
Question
Hello everyone,

I'm new to using jQuery, and I've been following a few tutorials and grind some code to get it working.
I am stuck at the moment trying to get a value passed from a javascript function, to the outsystems context (I need that value on a screen action...)

Can anyone tell me the right path to go? I've trying session variables, but that isnt working either...
2019-11-12 17-31-26
Justin James
 
MVP
Make an input box on the screen, use a style or CSS class to give it the style "display: none;" so it is not showing. Then use jQuery to set the value of that input box. Give the input box a name, and in the expression with the jQuery code, do something like:

"<script>
$('#" + NameOfBox.Id + "').val('value to set');
blah...
blah...
blah...
</script>"

In your screen action you can look at the variable bound to the box to get its value.

J.Ja
UserImage.jpg
Bruno Alves
Justin James wrote:
Make an input box on the screen, use a style or CSS class to give it the style "display: none;" so it is not showing. Then use jQuery to set the value of that input box. Give the input box a name, and in the expression with the jQuery code, do something like:

"<script>
$('#" + NameOfBox.Id + "').val('value to set');
blah...
blah...
blah...
</script>"

In your screen action you can look at the variable bound to the box to get its value.

J.Ja
 Thank you very much for your answer! That did solve my problem :)
 
2024-10-25 09-14-42
Christopher Bautista

Hi Justin,


How about to a session variable? I plan to use a JQuery to set a Session Variable's value when the button is clicked (button has a Navigate Method).

Please advise.


Thank you.


Kind regards,

Christopher

2019-11-12 17-31-26
Justin James
 
MVP

Christopher Bautista wrote:

Hi Justin,


How about to a session variable? I plan to use a JQuery to set a Session Variable's value when the button is clicked (button has a Navigate Method).

Please advise.


Thank you.


Kind regards,

Christopher

Would work the exact same way, just bind the input box to the Session variable in question. Or write a REST service for this and have the JavaScript call the REST service.

J.Ja


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