my problem is, that I want to render form2 conditionally. This collides with a ajax update event of another form1, which should trigger the rendering of form2.
<h:form id="form1">
<h:selectOneMenu id="selectedGroupId" label="#{msgs.group_group}" value="#{groupBean.selectedGroupId}">
<p:ajax event="change" listener="#{groupBean.selectGroupEvent}" update=":form1"/>
<f:selectItems value="#{groupBean.availableGruppen}" />
</h:selectOneMenu>
</h:form>
<h:form id="form2" rendered="#{not empty groupBean.groupDto}">
<p:panelGrid id="groupEditGrid">
...
</p:panelGrid>
</h:form>
Is there a way of doing this without putting the render condition inside a component of form2?
Thanks
Jonny
You cannot update a component that is not on your page. But you could wrap your form in a h:panelGroup
that is not rendered contitionally and update the wrapper instead.
Example:
<h:form id="form1">
<h:selectOneMenu id="selectedGroupId" label="#{msgs.group_group}"
value="# {groupBean.selectedGroupId}">
<p:ajax event="change" listener="#{groupBean.selectGroupEvent}"
update=":formWrapper"/>
<f:selectItems value="#{groupBean.availableGruppen}" />
</h:selectOneMenu>
</h:form>
<h:panelGroup id="formWrapper>
<h:form id="form2" rendered="#{not empty groupBean.groupDto}">
<p:panelGrid id="groupEditGrid">
...
</p:panelGrid>
</h:form>
</h:panelGroup>