Added javascript is not called

Added javascript is not called

  

Hello gurus,

I'm new to outsystems and I want to integrate some javascript code to display a message in a web screen. I've added the simple code in HomeScreen under Advanced->Javascript (see screenshot below).  But the message is not showed and seems like the function is not called.  Has anyone an idea why?


Thanks,

Daniel Xu

Hello,

The code you posted defines the function, but you also need some code to actually call that function. For instance, if you wanted to call the function when the user clicks on a label, you could use the label's Extended Properties, as shown below:

Thank you very much Aurelio.  This is exactly what I missed!

Aurelio Santos wrote:

Hello,

The code you posted defines the function, but you also need some code to actually call that function. For instance, if you wanted to call the function when the user clicks on a label, you could use the label's Extended Properties, as shown below:

Hi Aurelio, this question is solved.  And I tried to call a function which displays a line object in google map in the same way but after the event takes place no map shows.  I wonder if anything is again missing.  Any idea?



Hi Daniel,

Are there any error messages in the console?

Aurelio Santos wrote:

Hi Daniel,

Are there any error messages in the console?

Hi Aurelio,

I've adjusted my code a few times and now I can see a Google Map example with line object.  However I've to use a div (

"<div id='map' style='height: 940px; width:940px'></div>"

) in the same page with a google map component so that I don't have to import the google map library myself.  As a result there are 2 maps in a screen.  Not the best way...

 Can I let Outsystems call an independent html webpage and use it in a screen (a bit like using web block)?  In that way I have complete freedom to develop my own webpage and employ it in an outsystem app screen.


Solution

Hi Daniel,

You can do that using an iframe. Drop an expression in your screen, set its "Escape Content" property to "No" and its value to the following:

"<iframe src='" + frameSrc + "'></iframe>"

Where "frameSrc" is a screen variable that contains the URL of the page you wish to display.

Solution