More about Edit Input rules
When users submit an HTML form, data is transmitted to the Web server in normal HTTP format and is then stored by Pega Platform 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 Javadoc documentation for more details.
You can view the generated Java code of a rule by clicking
. You can use this code to debug your application or to examine how rules are implemented.