More about HTML Property rules |
Click the Preview toolbar button () to access a split-screen preview of the runtime appearance of properties that reference the open HTML Property rule. You may be prompted for a property type. If the property supports update mode, type or select a value and click Show output to see an approximate preview of both read-write and read-only modes.
If you leave the HTML Property field of a property rule blank, the system uses the standard HTML Property rule named Default. If you don't want the system to use this standard HTML Property, select another standard HTML Property rule or create another rule.
You can use a pega:when JSP tag in HTML Property rules to determine whether the display is in read-write mode or read-only mode.
This example of a When directive displays an error image when a user enters an invalid value for a property. It calls the PublicAPI method isBad. Other useful PublicAPI methods are documented below.
{when $THIS:isBad}
<img src=“redflag.gif”
id=“PegaRULESErrorFlag” >
{endwhen}
You can use the when JSP tag in HTML Property rules only in places where an active property exists. The JSP tag can call any Java methods in the PublicAPI ClipboardProperty interface that require no parameters and return true or false.
Use the when directive or pega:when JSP tag in an HTML Property rule to determine whether the display is in read-write mode or read-only mode:
The $mode-display
keyword is true when the
property is displayed in review (read-only) mode.
{when $mode-display}
enter your HTML here
{endwhen}
When a property appears in this mode, users cannot update the value of the property.
The $mode-input
keyword is true when the
property is presented in update (read-write) mode.
{when $mode-input}
enter your HTML here
{endwhen}
When a property appears in update mode, users can enter property values.
This example causes the final HTML to display a read-only value if in review mode, and a select box with three choices if in update mode.
{when $mode-display}
{$this-value}
{else}
<SELECT>
<OPTION
VALUE=“Best”>Best</OPTION>
<OPTION
VALUE=“Replaced”>Replaced</OPTION>
<OPTION
VALUE=“Obsolete”>Obsolete</OPTION>
</SELECT>
{endwhen}
Only properties of mode Single Value
can be
manipulated in HTML. Every Single Value
property
has a Type. The types are: Text
,
Identifier
, Password
,
DateTime
, Date
, Double
,
Time of Day
, True or False
,
Integer
, and Decimal
.
The corresponding keywords that identify the types are:
You can review these examples in the standard HTML Property rule named Default. Here is one example:
{when $this:TYPE_TRUEFALSE}
<INPUT TYPE=“RADIO”
VALUE=“true”>Yes
<INPUT TYPE=“RADIO”
VALUE=“false”>No
{endwhen}
Use the <pega:static > JSP tag to incorporate a text file, stored in a text file rule, that contains JavaScript functions needed.
For best performance, use this technique to reduce HTTP traffic and workstation memory. When one JavaScript file is needed by multiple HTML Property rules:
If multiple JavaScript files are required, create a bundle rule (Rule-File-Bundle) to manage them using a single named reference. For example, the standard AutoComplete HTML Property rule includes the following code:
<pega:onlyonce
name="AutoComplete_Variables">
<pega:static type="script"
app="webwb">
<pega:file name="pega_ui_autocomplete.js"
/>
<pega:file name="pega_ui_datasource.js"
/>
<pega:file name="pega_ui_acdatasource.js"
/>
</pega:static>
<pega:include
name="PegaToolsCacheInclude"/>
</pega:onlyonce>
Your application can use SmartPrompt processing — a JavaScript function — to allow users to select an element of a list or type in a value. (Controls known as combo boxes provide this in Windows applications. HTML forms do not have a directly equivalent capability.)
Several standard HTML property rules support SmartPrompt to allow users to select a text property value, including:
HTML Property rule |
Notes |
SmartPromptSkills | Displays the keys of skill rules. |
SmartPromptforClass | Lists class names |
SmartPromptRuleSet | Lists the RuleSets this user may access. |
SmartPromptRoutingDecision Tree | Displays all decision tree rules available to this operator that apply to the Data-Admin-Operator-ID class. |
You can include SmartPrompt support using these standard rules or a similar application-specific HTML Property rule. The choices that appear can be defined by keys to instances or as values on the Table Edit are of the General tab of the Property form.
When you save an HTML Property rule, the system converts your HTML and JSP tags (or directives) to Java source code. As a learning or debugging aid, you can review this Java code.
Click the Show Java toolbar button () to see the system-generated Java code that implements the rule. The window presents a read-only preview of the Java that implements this rule instance. This Java code is not identical to the Java that is executed at runtime, which includes Java code inlined from other rule instances and reflects rules in the requestor's RuleSet list.
Through directed inheritance, the Rule-HTML-Property class is a subclass of the Rule-Stream class.