Class VConditional

java.lang.Object
fc.web.forms.FormValidator
fc.web.forms.VConditional
Direct Known Subclasses:
VFilledOnChoice, VFilledOnFilled

public abstract class VConditional extends FormValidator
Validates that certain conditions in one or more fields in the form require other conditions of some other fields in that form.

Since the pre/post conditions can be arbitrary, this class defines abstract methods called preConditionMet(FormData, HttpServletRequest) and postConditionMet(FormData, HttpServletRequest). If the pre condition is true, the post condition must also be true. Subclasses should implement both methods as appropriate.

  • Constructor Details

  • Method Details

    • validate

      public boolean validate(FormData fd, jakarta.servlet.http.HttpServletRequest req)
      Returns the value returned by postConditionMet(FormData, HttpServletRequest) if the pre conditions were met. (preConditionMet(FormData, HttpServletRequest) returned true). If the pre condition was not met, there is no need for further validation and this method will return true.
      Specified by:
      validate in class FormValidator
      Returns:
      true is validation succeeded, false otherwise
    • preConditionMet

      public abstract boolean preConditionMet(FormData fd, jakarta.servlet.http.HttpServletRequest req)
      Subclasses should implement this method to check that certain fields or pre-conditions have been met. Only gf these conditions have been met will there be a check to see that the post conditions are also true.
      Returns:
      true if the pre-conditions have been met, false otherwise
    • postConditionMet

      public abstract boolean postConditionMet(FormData fd, jakarta.servlet.http.HttpServletRequest req)
      Subclasses should implement this method to check that certain post conditions have been met. This method will only be called if the preConditionMet(FormData, HttpServletRequest) method returns true.
      Returns:
      true if the post-conditions have been met, false otherwise