Adding Validators

You can assign TextInput a vector of validators. Validator validates the text input’s value based on the validation types and patterns.

The following is a code example for adding validators:

case TEXTINPUT1:
  TextInput localtextInput1 = (TextInput) object;
  Vector textField1ValidateVector = new Vector();
  textField1ValidateVector.addElement(new
  Validator("PATTERN_MATCH", "CONTAINS", "my", 
            "The input does not contain {0}."));
  textField1ValidateVector.addElement(
     new Validator("PATTERN_MATCH", "STARTS_WITH", "sup", 
                   "The input must start with {0}."));
  localtextInput1.setInvalidValueMessage(
     "Enter a valid value (data type {0} and logical type {1}).");
  localtextInput1.setValidators(textField1ValidateVector);
  localtextInput1.setFontStyle(styleEdit_box_Style);
break;