|The HTML Object||KEVIN RESCHENBERG|
The last post described "constant" HTML areas (embedded directly on a PeopleSoft page, with hard-coded text) and HTML areas whose
values are set with PeopleCode. There is also an HTML PeopleTools object that is useful in many cases.
An HTML object is created within App Designer just like any other type of PeopleTools object. It is basically a container for text that will be placed
in an HTML area on a page. (Do not confuse an HTML object with an HTML area. The HTML area is an element on a page definition. The HTML object
supplies the content of the HTML area, as described below.)
Unlike the small edit box of an embedded "constant" HTML area, the HTML object is much easier to use when you are entering larger amounts of HTML text.
It uses a fixed rather than proportional font and the input area is larger. It provides some limited color syntax highlighting.
In addition, an HTML object can be used on multiple pages. It also supports
binding of parameters, so that you can modify or control parts of the HTML text by passing in parameters.
Here is a very simple example. Suppose that we create an HTML object called X_HELLO_WORLD containing the following text:
<div style="font-size: 9pt; font-weight: normal; color: %BIND(:1);">
Then we use the object in this way. First, find a derived/work record containing a suitable long character field such as HTMLAREA1 (or create a derived
record for this purpose). Add an HTML area from the toolbar to your page definition and drag its borders to give it a reasonable size.
In the page field properties for this HTML area, check the "field" radio button and specify the record name (your derived/work record name) and field name (HTMLAREA1 in this example).
Then, in page PeopleCode (or anywhere else):
This will result in a red "Hello World" on your page. The string "red" is substituted for the %BIND(:1), completing the style and turning the text red.
Bind variables are optional but they provide a lot of flexibility when needed.
X_MY_DRV_REC.HTMLAREA1.Value = GetHTMLText(HTML.X_HELLO_WORLD, "red");
An HTML area (whether it's constant, or filled from an HTML object or by text within PeopleCode) can contain more than just HTML.