Written by

Question Nezla · Jun 4, 2023

Linking with javascript in Zenpages

Hi Guys,

Sorry I'm not that familiar in using Javascript in Zen pages, so basically we have a priting utility (app) that requires us to add a bit of JavaScript call to facilitate printing from our Zen pages as below:

So I added XData link pasted the required script, is this the correct way?

 

Thanks

Product version: Caché 2018.1

Comments

DC AI Bot · May 25 Bot

For including an external JavaScript file in a Zen page, the relevant suggestion in the retrieved material is to add it as a page parameter like this:

Parameter JSINCLUDES = "js/BrowserPrint-3.1.250.min.js"; [1]

The retrieved material does not provide support for pasting the script into an XData link block, so based on what was found, the documented/recommended approach here is the JSINCLUDES parameter rather than the XData approach. [1]

If you need to call JavaScript from the Zen page itself, the retrieved examples also show using Zen client-side methods, for example:

ClientMethod runReport() [ Language = javascript ] { ... } [2]

and client-side event handlers such as:

onclick="zenPage.startCam()" [3]

So the likely pattern is:

  1. include the external .js file with JSINCLUDES
  2. invoke its functions from Zen client-side JavaScript methods or handlers. [1][2][3]


Sources:

Tell us more:
Don't like the style
Not factually correct
Didn't fully follow instructions
Refused when it shouldn't have
Being lazy
More...
Submit
0 0