Back Forward More about Control rules
 

  1. About
  2. New
  3. Control
  4. HTML
  5. Parameters
  6. Pages & Classes
  7. History
  1. More...

Previewing Control rules

Click the Preview toolbar button (Preview) to access a split-screen preview of the runtime appearance of properties that reference the open Control 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. B-18298

The Default Control rule

If you leave the Control field of a property rule blank, the system uses the standard Control rule named Default. If you don't want the system to use this standard Control rule, select another standard Control rule or create another rule.

Testing the mode with a when JSP tag

You can use a pega:when JSP tag in Control 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}

NoteYou can use the when JSP tag in Control 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.

Review mode

Use the when directive or pega:when JSP tag in a Control 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.

Update mode

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.

Example

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}

Conditionalizing on type

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 Control rule named Default. Here is one example:

{when $this:TYPE_TRUEFALSE}
    <INPUT TYPE=“RADIO” VALUE=“true”>Yes
    <INPUT TYPE=“RADIO” VALUE=“false”>No
{endwhen}

Including only one copy of JavaScript code

Use the <pega:static > JSP tag to incorporate a text file, stored in a text file rule, that contains JavaScript functions needed.

Advanced featureFor best performance, use this technique to reduce HTTP traffic and workstation memory. When one JavaScript file is needed by multiple control rules:

  1. Wrap the JavaScript in a <pega:onlyonce > tag
  2. Place the JavaScript source code in a Rule-File-Text rule
  3. Include the text file rule using a <pega:static > JSP tag. 

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 Control 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>

Configuring SmartPrompt for application properties

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 Control rules support SmartPrompt to allow users to select a text property value, including:

Control 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 Control rule. The choices that appear can be defined by keys to instances or as values on the Table fields of the General tab of the Property form.

Java code display

When you save a Control 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.

C-1665Click the Show Java toolbar button (Show Java) 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.

Parent class

Through directed inheritance, the Rule-HTML-Property class is a subclass of the Rule-Stream class.

Security

If your application RuleSets contain Control rules, run the Rule Security Analyzer before locking a RuleSet Version, to look for possible security issues.

Definitions active property, scratchpad
Related topics Onlyonce JSP tag
Save JSP tag
Static JSP tag   
When JSP tag

How to reference properties indirectly in JSP tags
Standard rules Atlas — Standard Control rules accepting parameters
Atlas — Standard Control rules without parameters

UpAbout Control rules