Reading a screen parameter in javascript


I'm trying to read a screen parameter in javascript but until now I failed.

I'd like to know first of all if it's possible, and if yes, I appreciate a little help to put my code working.
The code is the following:

I'm passing the parameter "Is2Show" type Text with the value "False" and I have the following code onload called by the function printit():

function printit(){
if ('<%#Session["Is2Show"]%>'=="False"){

Thanks in advance

Best regards
Pedro Alcântara
Hi Pedro,

First of all, welcome to the Community!

What you are trying to achieve can be done in (at least) two ways:

First, you can insert a javascript scriplet in your page using Unescaped Expressions. These are expressions that won't be escaped and therefore will show up in the page as they are. This means you can insert javascript code in the middle of your page. To do this, drag an expression to the screen, then open it with the Expression Editor and insert something like :
"<script> function printit(){ if ('"+ls2Show+"''=="False"){ window.print(); setTimeout("window.close()",1000); } } "

As you can see, this is a fairly regular expression (the same you used) were I accessed my screen parameters just by concatenating the value with the rest of the expression.

The second way, which is probably easier and better on your particular scenario, is just to add this as an Extended property for your screen (you're already using that for onload, right?). In the Extended Property editor, you can also access your screen parameters.

Just one final note, you can't use <%#%>-like constructs in OutSystems applications. Instead, just use Expressions.

I hope to have helped. Have fun with the platform and come back if you need any further help.