tags:

views:

3173

answers:

3

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.

+4  A: 
McDowell
Thanks, but where should I put the ajaxSingle attribute?
volothamp
On the aj4:support tag.
McDowell
A: 

What is the scope of mybean? If it's request scope then its value will be reset when you click the button and the input field might be processed at all (if rendered resolves to 'false').

Max Katz
A: 

excellent answer McDowell, best regards

sam