My dialog of type "okCancel" does not trigger any event on the server when the ok button is clicked.
The cancel button is working fine, just hiding the popup.
I'm using Oracle ADF Faces 12.1.3 and JBoss seam 2.3 for injecting beans.
Here is the popup and dialog code :
<af:form id="mainForm">
<af:panelStretchLayout id="psl1">
<!-- page layout -->
</af:panelStretchLayout>
<af:popup id="myPopup"
binding="#{bkBean.myPopup}"
contentDelivery="lazyUncached">
<af:dialog id="myDialog" closeIconVisible="true"
modal="true" okVisible="true" cancelVisible="true"
title="Import from server to #{bkBean.file.name}"
type="okCancel"
dialogListener="#{bkBean.doSomething}">
<af:panelFormLayout id="pfl1">
<!-- Several input text here -->
</af:panelFormLayout>
</af:dialog>
</af:popup>
</af:form>
Here is the code for the dialogListener. I set a debug point at the if statement:
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
@Name("exportImportServer")
@Scope(ScopeType.SESSION)
public class ExportImportServerBean implements Cleanable {
public void importFromServer(DialogEvent event) {
if (event.getOutcome() == DialogEvent.Outcome.ok) {
}
}
}
The exportImportServer backing bean is in session scope.
If I toggle a break point in the first code line inside the exportImportServer backing bean importFromServer method it does not stop inside. This method does not get called. It seems that nothing happens (even I have no errors) except that the main form is submitted.
In debug mode after a click on the ok button I'm able to stop inside a PhaseListener beforePhase(PhaseEvent phaseEvent)
method. But I don't really know if the backing bean method should be called after the PhaseListener beforePhase(PhaseEvent phaseEvent)
method.
I'm searching for any hint on how could I debug it ?
Is there any javascript called when Ok button is clicked on dialog ?
UPDATE: it seems that the problem comes from the fact that the popup is called from a region of the page and defined in another page (the main page containing the region) as seen in the code below :
Inside main.xthml:
<af:document>
<af:form id="mainForm">
<af:panelStretchLayout id="psl1" topHeight="auto" bottomHeight="0">
<f:facet name="center">
<af:region id="myRegion" showHeader="never"
value="#{main.regionModel}" />
</f:facet>
</af:panelStretchLayout>
</af:form>
<af:popup id="myPopup"
binding="#{bkBean.myPopup}"
contentDelivery="lazyUncached">
<af:dialog id="myDialog" closeIconVisible="true"
modal="true" okVisible="true" cancelVisible="true"
title="Import from server to #{bkBean.file.name}"
type="okCancel"
dialogListener="#{bkBean.doSomething}">
<af:panelFormLayout id="pfl1">
<!-- Several input text here -->
</af:panelFormLayout>
</af:dialog>
</af:popup>
</af:document>
Inside myRegion.xhtml:
<?xml version='1.0' encoding='UTF-8'?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:trh="http://myfaces.apache.org/trinidad/html"
xmlns:tr="http://myfaces.apache.org/trinidad"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<af:tree ...>
</af:tree>
<!-- Contextual Menu -->
<af:popup id="pp1" contentDelivery="lazyUncached">
<af:menu>
<af:commandMenuItem text="Do something" immediate="true"
rendered="#{bkBean2.isRendered}" icon="icon.png" actionListener="#{bkBean2.showMyPopup}" />
</af:menu>
</af:popup>
</ui:composition>
It works if I define the popup inside myRegion.xhtml but not if I define the popup inside main.xhtml.
Thank you for any hints on how to make it work with the popup defined inside main.xhtml ?
dialogListener="#{ExportImportServerBean.importFromServer}">
May be its a spell mistake. You can test if the method to be called is right if you press 'ctrl' and click on the method name in your jsff page. Does the navigation take you to the Method? written in your bean? – Soumya RdialogListener="#{bla bla}"
and it does not show any error, nothing. Is this behavior normal ? – jerome