My problem is that in the preparation of a web screen I'm trying to call a javascript method that is in a web block contained in the web screen. If I put the method in the web screen javascript propertie it works! but that javascript method just make sence with the use of that web block, so makes more sence in the webblock.

But every time I call that peace of javascript I receive the error:  "method() undefined"...

I already tryed to put that method inside a " $(document).ready(function(){ " and the result was the same... 

I already tryed to put the javascript method in the module javascript property and the result doesn't change... 

Could you help me?

Hi Ricardo,

Can you share and oml with this error reproducable?



Hi Daniël,

First of all thank you for your fast reply! But as you can imagine I can't share the oml. So I create a new one just to try to reproduce that strange behavior!
But ... It works just fine, without any error... =0

So I back to my project and I tryed againd but just with an alert() and then I clean the cookies and all temporary stuff... Than I run the project again and this time... It works just fine...

So... I think the problem was solved by itself =D

Thank you again!

Hi Ricardo Silva,

You are trying to call the JS Method defined in a WebBlock from a WebScreen.Now you are getting the Error Methos Undefined because of WebScreen Preparation runs before WebBlock Preparation.

when you defined the same JS in WebScreen JS Property, it works fine because while the preparation runs & you call the JS Method it is ready & loaded.

I would suggest you to:

  • Keep the JS in Webblock
  • Instead of calling it from WebScreen, Call it from WebBlock Preparation.


  • There's a patch-work trick which I would not prefer to use: You can use a timer-delay i.e keep your code as it is, JS in WebBlock & method call in Webscreen preparation but call the  JS method with a delay of some seconds like :

setTimeout(function() { yourJSMethodName(); }, 5000);

Also please specify what is the reason you want the JS Method call to be in preparation of WebScreen only so that folks here can come up with the best solutions.

Hope it helps,