More about Edit Input rules

  1. About 
  2. New 
  3. Java 
  4. History 
  5. More... 

When users submit an HTML form, data is transmitted to the Web server in normal HTTP format and is then stored by Pega 7 on a user's clipboard, using the property name from the HTML form.

Text box example

For example, the source HTML for a text box can look like:

<INPUT TYPE=TEXT NAME=myPage.myPropertyName SIZE=30 >

In this example, a user views a text box, enters data into it, and clicks a submit button. This action conveys the data that this user entered to myPage in the clipboard. The value the user entered becomes associated with myPropertyName.

To cause the system to convert user-entered data to data that the system can interpret, reference an edit input rule in the property. When a user submits the form, the system converts the data value associated with that property as instructed by the Java in the edit input rule. The system places only the converted value on a user's clipboard.

For example, an edit input rule can convert all characters to lower or uppercase, delete certain characters, or truncate the input to a maximum length.

Table lookup example

A more complex input transformation can involve a table lookup defined through Java code.

If a user types XL (for Extra Large) into a field containing the HTML element:

<INPUT TYPE=TEXT NAME="Size" SIZE="3">

an edit input rule referenced in the Size property instance can convert XL to 12 for size 12. The table converts S (for small), M (for medium) and L (for large) into other numeric values.

Calling edit input rules explicitly

The system automatically executes an edit input rule referenced in a Single Value property when it processes user input from an HTML form that supplies that property.

Alternatively, in an activity, you can execute an edit input rule using a function. Use a Java step. In the Java code of that step, call the editInput() function. Consult the PublicAPI JavaDocs for more details.

Java code display

When you save an edit input rule, the system converts the rule 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.

Definitions property mode
Related topics About Property rules
About Edit Validate rules
Property-Validate method

UpAbout Edit Input rules