I have ideas on how to handle this situation, but none seem very
elegant. What I have is a filter dialog for our application. The UI
has options where the user chooses if they want to filter by
something, and then they can type in the value. A simplistic
representation:
<label>
<t:selectBooleanCheckbox
value="#{bean.filter}" />
Search for value:
</label>
<t:inputText
required="#{bean.filter}"
value="#{bean.filterValue}" />
Now most sound notice the problem immediately, the required of the
inputText will be evaluated against the bean's value which at
validation time has not been updated yet, the value that I really
want to compare is the submitted value of the checkbox.
Marking the checkbox as immediate does not help, as that just changes
when validation takes place in UIInput, not when the update is
processed. There is no easy way I know of in JSF to have the required
based on the state of the checkbox.
Anyone know of a good solution for this without performing the
validation in the INVOKE_APPLICATION phase (in the action or
actionListener)?