Back Forward Edit Validate form
Completing the Java tab

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

Enter the body of a Java boolean function here. The value your Java code is to validate is in an automatically declared variable named theValue.

Design the function to return true when the value is valid, and otherwise return false.

NoteYour validation code can check character limitations, format limitations, or value range limitations. However, do not implement cross-edits — comparisons of one input field against another — in edit validate rules that are to be used in client-side validation, as the other inputs may not be available at the time the edit validate rule executes.

See More about Function rules and Examples — Using inline Java and PublicAPI facilities for additional guidance on Java code you can use here.

Field

Description

Java Source  
Java

Enter your Java source directly into the text area, Alternatively, click (magnifying glass) to open your workstation's Java editor or Notepad.

Include a Java return statement in the Java source code.

Enter your Java using the editor, then exit from the editor to return the resulting source code into the form. See open authoring for instructions on setting up a Java editor.

NoteUse the String.equals() Java method, not the == or != operators, to compare the value of a property to a literal string or to the value of another property. C-2461 SR-6777 SR-6784 B-24774

You can use the normal syntax to call a function rule: B-16506 MIRAT

ruleset_library.FunctionName(arg1, arg2, arg3)

where the RuleSet and library name are in lowercase but the function name is in exact case. For example: KAUFT 11/1/06 B-24475

double d_result = pegarules_math.Sqrt("4")

Old In releases before Version 4.2SP6, a different fully qualified syntax was employed to call function rules. It still executes correctly, but is deprecated. SR-1136 B-16506 calling functions need fully qualified name

Notes

NoteTo associate text from a message rule with the property, use the addMessage() PublicAPI method, as in following Java statement:

theProperty.addMessage("RuleMessageKey\tText1\tText2...");

where RuleMessageKey is a key to a Rule-Message rule, and the optional Text1, Text2 and so on are text values — separated by a backslash and literal t character — that supply values for the numbered parameters {1}, {2},... in the message rule text. (This method has no effect if the message identified by RuleMessageKey is already present.) R-19895

Up About Edit Validate rules