Class RequiredIfValidator

All Implemented Interfaces:
HasHandlers

public class RequiredIfValidator extends Validator

RequiredIf type validators should be specified with a RequiredIfFunction, which has to be passed to setExpression(), and takes two parameters:
  • item - the DynamicForm item on which the error occurred (may be null)
  • value - the value of the field in question

When validation is perfomed, the expression will be evaluated - if it returns true, the field will be treated as a required field, so validation will fail if the field has no value.

  • Constructor Details

    • RequiredIfValidator

      public RequiredIfValidator()
    • RequiredIfValidator

      public RequiredIfValidator(RequiredIfFunction expression)
  • Method Details

    • setExpression

      public void setExpression(RequiredIfFunction expression)
      Set the expression.
      Parameters:
      expression - the expression