a4j:commanButton inside the popupPanel don't execute for the first time
yarv Aug 4, 2011 3:03 AMI have a popupPanel and a4j:commanButton inside the popupPanel which calls a session scoped bean's method. When page loaded popupPanel and a4j:commanButton with id “popup” not rendered. If I click on a4j:commanButton with id “show” then property bean.render will set with “true”, h:panelGrid will reRender, popupPanel and a4j:commanButton with id “popup” will be shown. Methods of session scoped bean, which calls by clicking a4j:commanButton with id “create” or “cancel” will be executed only for second time click. I have to call popupPanel for the second time and only then methods will be executed.
<h:form>
<a4j:commandButton id="show" value="show" render="table" action="#{tabsBean.setRenderTrue}">
</a4j:commandButton>
</h:form>
<h:panelGrid id="table">
<a4j:commandButton value="Register S-ACS" id="popup" rendered="#{bean.render}">
<rich:componentControl event="click" operation="show"
target="panel" />
</a4j:commandButton>
<rich:popupPanel id="panel" modal="true" width="900"
height="320" rendered="#{bean.render}">
<f:facet name="header">
<h:outputText value="Test"></h:outputText>
</f:facet>
<f:facet name="controls">
<h:outputLink value="#"
onclick="#{rich:component('panel')}.hide(); return false;">
X
</h:outputLink>
</f:facet>
<h:form>
<h:panelGroup id="objectCreationPanel" layout="block">
<h:panelGroup>
<h:panelGrid columns="2">
<h:outputLabel for="ipInput">
<h:outputText value="Ip Address" />
<h:outputText value="*" styleClass="required-field" />
</h:outputLabel>
<h:inputText id="ipInput"
value="#{bean.object.ip}">
</h:inputText>
<h:outputLabel for="portInput">
<h:outputText value="JNDI Port" />
</h:outputLabel>
<h:inputText id="portInput"
value="#{bean.object.jndiPort}">
</h:inputText>
</h:panelGrid>
</h:panelGroup>
<h:panelGrid columns="2" width="40%" style="margin: auto;">
<a4j:commandButton id="create" style="float:left"
action="#{bean.add}" value="Save"
render="dataOutput" execute="@form"
binding="#{bean.createButton}"
oncomplete="#{rich:component('panel')}.hide(); return false;" />
<a4j:commandButton id="cancel" style="float:right;"
action="#{bean.cancel}" value="Cancel"
oncomplete="#{rich:component('panel')}.hide(); return false;"
execute="@this" />
</h:panelGrid>
<h:panelGroup style="width:100%;">
<h:message for="create" errorClass="validation-error" />
</h:panelGroup>
</h:panelGroup>
</h:form>
</rich:popupPanel>
</h:panelGrid>