webtier@glassfish.java.net

Custom validator, empty inputTextarea

From: Uwe Seimet <Uwe.Seimet_at_seimet.de>
Date: Fri, 22 Aug 2008 10:20:11 +0200

Hello,

I wonder how I can write a custom validator that conditionally validates
a non-required h:inputTextarea, depending on the state of an
h:selectBooleanCheckbox. The validation should fail if the inputTextarea is
empty and the selectBooleanCheckbox is not checked.
When adding a custom validator to the h:inputTextarea I have the problem
that validate() is not called as long as there is no content in the
inputTextarea. But I would like the validator to be consulted particularly
when the inputTextarea is empty, since this is part of the validation rule.

Any idea how to solve this? I am thinking about adding a custom validator
to the selectBooleanCheckbox and rendering the error message for the
inputTextarea within this validator. But I don't like adding a validator
to one component in order to check the validity of another.

Best regards Uwe