Frequently Asked Questions

Mar 19, 2025 - 11:29am

 [F] Frequently Asked Questions  / Operational Questions  / Macros and Templates  / WCJS (Server Side JavaScript)  /

How Can I Pass parameters from WCTL to a WCJS function?

Rate This FAQ
 (Not yet rated)

Created On: 5 Jun 2002 10:23 am
Last Edited: 5 Jun 2002 10:23 am

Question Printer Friendly

I want to pass parameters from WCTL to a WCJS function. How do I do this?

Answer

There are several
  ways of passing parameters from WCTL to a WCJS function:

If you want to pass actual parameters via jsEval (which evaluates a JavaScript
  expression) you can first create a string that contains the call, including
  the parameters. For example:



%% set jsCall "myFunction(" & a & "," & b & ")" %%



Then
  you can use



%% jsCall.jsEval %%


In your WCTL to
  invoke the function.


You can also pass the variables via path, session or user variables. Those are all shared between WCTL and WCJS.


You can also directly access a local WCTL variable from inside a WCJS function
  with the wctlVar("varName") function.