Custom JavaScript


I am using ONE 8.2.6 and trying to find out about custom JavaScript code in NAT Pages.

The following Help path

says that a NATPAGE has the following attribute:

  • Comma separated is definitely wrong in 8.2.6. Semicolon is the correct separator. :!:
    This error appears in at least three places in the Help system.
  • I checked with the DATEINPUT control and found NO mentioning of the usage hinted at above. Can you give me an example?
  • How can custom scipt code obtain a reference to a control, such as a text field or a button on the NATPAGE?
    The usual document.getElementById() approach is obviously leading nowhere.
  • Is it safe for custom code to hook into the window.onload event handler?
  • Are the custom scripts loaded before or after the system scripts?
  • Are there certain public “official” toplevel methods or functions which custom code can use to simplify interaction with the NATPAGE?
  • Natural code or an Adapter Listener, I assume, can NOT interact with custom script code. True?

I would greatly welcome some more background material about Scripting on NATPAGEs.


Hallo Hubert,

you can use the object csciframe in the html page to access certain javascript functions or elements.

In your javascript you can do something like this:
parent.document.getElementById(“csciframe”).contentWindow.setPropertyValue(‘someProperty’, value);

To add your html/javascript to the page, you can use the Adapterlistener:

I hope this will help you
Amjad Farajallah

Hi Amjad, hi Hubert,

you were mentioning 3 concepts:

  • IHTML Control
  • Adapter Listener
  • Custom Control

The IHTML Control supports for applying HTML and JavaScript dynamically at runtime. If you add your own JavaScript libraries to your page, then the JavaScript libraries are loaded when the page is loaded. But your HTML and JavaScript, which you implement in the IHTML control are loaded dynamically and usually you implement all the HTML/JavaScript of the control itself in your Natural code. You can of course also implement it in the Adapter Listener but still it provided by some code at runtime.

Amjad, I haven’t understood completely your suggestion to use the method Adapter.findCISSessionContext().getSessionBuffer().addHtml() in the Adapter Listener. Do you apply a complete HTML page? It’s not the HTML for the IHTML controls you are applying by using this method, is it?

The Adapter Listener is a general concept to hook into the SET/INVOKE/GET phases of the page processing. 1 good example for this is the PDF integration: When a method is called, you can call some other program or framework. There are of course many other usage scenarios.

Hubert, what do you want to do in your application? Could you please describe a little more detailed, what you would like to do? Thanks.

I have the feeling that you actually would like to customize existing controls or create your own controls. Is this correct? If yes, please have a look at the custom controls supported in NJX 8.2.7
Does this answer your questions regarding loading and function usage?

Best Regards,

Hello Christine,

I call the addHtml method in the adapterlistener to add own external html page which includes the customized javascript.

Best regards,
Amjad Farajallah