86
Views
4
Comments
How to pass javascript value into local variables at the preparation 
Question

In the 'preparation' of traditional web app, i have use javascript to prepare some data and want to assign the result into the input fields. However, the local variable doesn't contain any value. Please advise.


My Javascript code is as below.

SyntaxEditor Code Snippet

"var strtemp = 'hello world';" +
"$('#" + OutputFieldId +"').val(strtemp);" 
mvp_badge
MVP
Rank: #16

Hi Jessica,

JavaScript runs on the client side and preparation has the name indicates prepares the screen to be rendered. Since the screen itself still doesn't exist you can't execute Javascript. You need to have that JS run on window.onload or $( document ).ready (if you want Jquery)

Why you have JS to prepare the data and you don't do it in Outystems code?

Regards,

Marcelo

Rank: #90

Hi Jessica,

As Marcelo said right , why you need to JS on prepration.

You can do it same like.

$(document).ready(function({

$(".InputClass").val("hello world");

$("#InputID").val("hello world");

}));


put this js on page JS block.

Regards

Rahul Sahu

Rank: #920

Thank for your response.

As I use encrypted string to pass to traditional web app using querystring in get method. Once I render data, I need decrypt these querystring in the preparation. May you how to decrypt in AES? Or how to post querystring?

Rank: #2227

Hi Jessica, there's  a crypto forge component that is commonly used, it has AES functions, maybe it will be usefull to you https://www.outsystems.com/forge/component-overview/437/cryptoapi


For example, we are using the component to pass input parameters to the screens encrypted so the user can't modify them.