Here is my composite component:
<composite:interface>
<composite:attribute name="attr1" />
<composite:clientBehavior name="xyz" event="valueChange" targets="chkbox" />
</composite:interface>
<composite:implementation>
<h:panelGrid>
<h:panelGroup>
<h:selectBooleanCheckbox id="chkbox"
value="#{cc.attrs.attr1}">
</h:selectBooleanCheckbox>
</h:panelGroup>
</h:panelGrid>
</composite:implementation>
And my page:
<h:form id="myForm">
<cc:myComp attr1="#{myBean.someAttr}">
<f:ajax render="myform:grid1" event="xyz" listener="{myBean.listenerMethod}"/>
</cc:myComp>
<h:panelGrid id="grid1">
<h:panelGroup>
<h:inputTextarea id="rationale" rows="4" cols="70"
value="#{myBean.rationale}" />
</h:panelGroup>
</h:panelGrid>
</h:form>
I’m getting below error:
<f:ajax>contains an unknown id ‘myForm:grid1’ – cannot locate it in the context of the component chkbox
If I remove render="myform:grid1" from my code then ajax call is working fine. Basically from my composite component I’m not able to refer another OUTSIDE component. How is this caused and how can I solve it?
Any client ID which does not start with the
NamingContainerseparator character, which is in your case:, is relative to the closestNamingContainerparent. The closestNamingContainerparent is in your particular case the composite component itself. So, this construct is basically looking for a component with the full client IDmyform:XXX:myform:grid1relative to the composite component, whereXXXis the autogenerated ID of the composite component. However, there’s no such component with this full client ID.Assuming that the full client ID of the panel grid is indeed
myform:grid1(i.e. when you open the page in browser, rightclick and View Source, you’re indeed seeing<table id="myform:grid1">), then you should make it an absolute client ID instead by prefixing it with theNamingContainerseparator character:See also: