Conditionally required jsf validation in a4j form

Posted by volothamp on Stack Overflow See other posts from Stack Overflow or by volothamp
Published on 2009-05-25T10:19:06Z Indexed on 2010/05/13 22:34 UTC
Read the original article Hit count: 231

Filed under:
|
|
|

Hello, I'm having a little problem with using conditionally evaluated expression in jsf/a4j

Here's my code

<a4j:form>
         <h:inputText id="id1" value="#{mybean.myvalue}" size="1"
                   required="#{not mybean.condition}"
                   rendered="#{not mybean.condition}"
                   requiredMessage="Put a number in here" />

           <h:selectBooleanCheckbox value="#{mybean.condition}">
                <a4j:support event="onclick" reRender="id1"/>
            </h:selectBooleanCheckbox>

<a4j:commandButton action="#{mybean.myaction}" value="Do something" />

 </a4j:form>

The boolean checkbox conditionally enable/disable the validation.

This doesn't work: the a4j:commandButton simply skip the validation.

Thanks.

© Stack Overflow or respective owner

Related posts about jsf

Related posts about seam