Skip to content Skip to sidebar Skip to footer

Stopping Getclientid() Computations In Js Code

I came across some interesting behaviour of the javascript code on my XPages //'rdoGeschlecht1' is present on page Basis (no problems there), //but not on page 'Stufe1'. var l

Solution 1:

The problem is you're commenting out the client-side JavaScript which is going to be run on the browser. But the server-side JavaScript code within #{javascript: (which needs to run on the server) is not commented out.

Perhaps it will help to explain what happens you put SSJS or EL in a string property or, in this case, a script block. Because the key is that the CSJS is not parsed on the server, it's just passed as a string to the browser.

The parser reads the string and looks for #{javascript: which tells it that the following code up to the closing } needs to be passed to the SSJS parser and the result added to the string that gets written to the browser. Any lines within that SSJS block that begin "//" will get omitted. But the parser will not take into account anything outside the #{javascript: because that is just text being passed to the browser. It is the browser that interprets the whole thing as client-side JavaScript.

Hopefully that clarified why it's working the way it is.

If you want to comment out a line in a script block that includes SSJS and you want to prevent the SSJS from running, you'll need to comment out the CSJS (so the browser doesn't run it) and the SSJS (so the server doesn't run it).

Post a Comment for "Stopping Getclientid() Computations In Js Code"