You are here: Reference > Rule types > Controls > More about Controls

More about Controls
 

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

Previewing Controls

Click the Preview toolbar button (Preview) 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.gif” id=“PegaRULESErrorFlag” >
{endwhen}

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

{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 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.

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

Control

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

Java code display

When you save a control, 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 (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 controls developed by your organization, 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

About the Rule Security Analyzer
How to reference properties indirectly in JSP tags
Standard rules Atlas — Standard Controls accepting parameters
Atlas — Standard Controls without parameters

UpAbout Controls