Skip to end of metadata
Go to start of metadata

Sample code:
Display file source:                 PUISAMPLES/QDDSSRC(DROPD005D)
RPGLE source:                      PUISAMPLES/QRPGLESRC(DROPD005R)

Widgets in Profound UI can also respond to events, such as onclick or onchange.  This allows us to add even more dynamic functionality to the Web application using client-side JavaScript code.  There are two ways to write code for JavaScript events -- inline or in an external JavaScript file.  When using an external file, you will generally place it on the IFS somewhere in the /www/profoundui/htdocs/profoundui/userdata/ folder.  You should then reference the external JavaScript file from /www/profoundui/htdocs/profoundui/userdata/html/start.html using a <script> tag.

If the JavaScript functionality is fairly simple, writing the code inline may be preferred.  Simply prompt the event in the Properties Window, and type the code.



Profound UI provides a number of useful JavaScript API to make coding easier.  The two most commonly used API are described below:

  • pui.click() – submits a response to the server.  This API can accept an optional parameter containing an ID or an object reference to a button, or a similar element, that has a bound response property to be sent to the server.  Sample usage:
  • getObj() – retrieves a reference to the DOM (browser’s Document Object Model) element given an element ID.  The function can be used to retrieve and set the content or CSS style of an element.  Sample usage:


Note: JavaScript and element IDs are case sensitive.

Note: In addition to attaching events to widgets, you may also attach events, such as onload and onsubmit, to the screen itself.

Labels
  • No labels