JSF code:
<rich:popupPanel modal="true" id="editPanelUser">
<h:form>
<h:panelGrid columns="2">
<h:outputLabel value="first name (*)" />
<h:inputText value="#{usersBean.currentItem.firstName}" />
</h:panelGrid>
<h:panelGrid>
<a4j:commandButton value="save"
oncomplete="if(#{facesContext.maximumSeverity==null}) #{rich:component('editPanelUser')}.hide()"
action="#{usersBean.runAction('saveUser')}"/>
</h:panelGrid>
</h:form>
</rich:popupPanel>
Backing bean code:
public void setRunAction(String action){
if("saveUser".equals(action)){
...
}
}
I put a breakpoint in the setRunAction method, but it never makes it here. Ideas?
What's weird is that the a4j:commandLink code that opens this popup works fine and calls the runAction method:
<h:form>
<rich:dataTable value="#{usersBean.dataList}" var="singleUser"
rowClasses="row1,row2" rowKeyVar="row" id="singleUserTable"
ajaxKeys="#{usersBean.keys}">
<rich:column>
<a4j:commandLink id="editlink"
oncomplete="#{rich:component('editPanelUser')}.show();return false;">
<f:setPropertyActionListener value="editUser"
target="#{usersBean.runAction}" />
</a4j:commandLink>
</rich:column>
</rich:dataTable>
</h:form>
Please try following XHTML code (also make sure that you do not have form inside another form element):
<rich:popupPanel modal="true" id="editPanelUser">
<h:form id="myForm">
<h:panelGrid columns="2">
<h:outputLabel value="first name (*)" />
<h:inputText value="#{usersBean.currentItem.firstName}" />
</h:panelGrid>
<h:panelGrid>
<a4j:commandButton id="myBtn" value="save"
oncomplete="if(#{facesContext.maximumSeverity==null}) #{rich:component('editPanelUser')}.hide()"
actionListener="#{usersBean.runAction('saveUser')}"/>
</h:panelGrid>
</h:form>
</rich:popupPanel>
And method in Managed bean:
public void runAction(String action){
if("saveUser".equals(action)){
...
}
}