Skip to main content

         This documentation site is for previous versions. Visit our new documentation site for current releases.      

More about Controls

Updated on November 15, 2021

Previewing Controls

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

The Default Control

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

Testing the mode with a when JSP tag

You can use a pega:when JSP tag in controls 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.png” id=“PegaRULESErrorFlag” >

You can use the when JSP tag in controls 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 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

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

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}
    <OPTION VALUE=“Best”>Best</OPTION>
    <OPTION VALUE=“Replaced”>Replaced</OPTION>
    <OPTION VALUE=“Obsolete”>Obsolete</OPTION>

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

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

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.

For best performance, use this technique to reduce HTTP traffic and workstation memory. When one JavaScript file is needed by multiple controls:

  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 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:include name="PegaToolsCacheInclude"/>

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

SmartPromptSkillsDisplays the keys of skill rules.
SmartPromptforClassLists class names
SmartPromptRuleSetLists the rulesets this user may access.
SmartPromptRoutingDecision Tree Displays all decision trees 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. 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.

Completing SmartPrompt fields

A triangle on the lower right corner ( SmartPrompt ) identifies text boxes with this capability. To complete a SmartPrompt box, place the insertion point inside the box and press the Down Arrow key. Double-click to select one choice from the list.

If the SmartPrompt list displays rule keys, those in the current class context appear first, followed by those in the immediate parent of the current class context, and so on up the class hierarchy. Rules in the @baseclass class appear last.

To select a property name (in the class determined by your current context, or an ancestor class of that class), type a period before pressing the Down Arrow key.

SmartPrompt is designed for rule forms. As a best practice, use the Dropdown control rather than SmartPrompt controls in harnesses, sections, and flow actions that support user forms. This approach offers better performance.

You can view the generated Java code of a rule by clicking ActionsView Java. You can use this code to debug your application or to examine how rules are implemented.

Parent class

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


If your application ruleset contains controls developed by your organization, run the Rule Security Analyzer before locking a ruleset version, to look for possible security issues.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best. is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us