You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-user@incubator.apache.org by "Counsell, Keith M." <km...@provbank.com> on 2006/06/29 20:54:31 UTC

Using PPR for dependent required-ness

Hello,
 
Can PPR be used to change an attribute of a component based on a value change for another?
 
A simple case is when at least one of two fields must be filled in.  After supplying a value for one it would be nice to set required="false" for the other.  I've attempted to do this with a backing bean with bound components for both af:inputText instances.  The JSF components are each set up thusly:
 
<af:inputText label="Required Field A"
        value="#{valueBean.reqFieldA}"
        id="reqFieldA"
        partialTriggers="reqFieldB"
        required="#{componentBean.reqFieldARequired}"
        autoSubmit="true"
        immediate="true"
        binding="#{componentBean.reqFieldAComponent}"
        valueChangeListener="#{componentBean.processValueChange}" />
 
Filling in a value and tabbing out tries to do the right thing: my ValueChangeListener is called, I see the new value, and I twiddle the required attribute on the reqFieldB component as well as setting the reqFieldBRequired property on the backing bean.  However, the input for reqFieldB is still required on the page after the partial update and I see this in the log:
 
16:38:09,471 INFO  [STDOUT] Jun 29, 2006 4:38:09 PM org.apache.myfaces.adfinternal.renderkit.core.ppr.PPRResponseWriter$PPRTag finish
WARNING: No PPR-capable id found for elements of CoreInputText[UIXEditableFacesBeanImpl, id=reqFieldB]. This component has not written-out an id attribute.
 
Reloading the page at this point does mark reqFieldB as optional, but moves it before reqFieldA.
 
I feel that I'm either close to getting something working or being an idiot.  Pointers would be much appreciated either way!
 
Many thanks,
Keith