Search code examples
jsfrichfacesoracle-adf

ADF popup cancel listener not invoked on closing dialog with error values


The issue is when I enter some negative value in the inputBox within the dialog component and the validator throws error something like "Negative numbers not allowed". The dialog now has an error input box marked with red border and I decide to click outside the dialog to close it and reset the input box, but the inputBox is not reset and if I press Esc key or Ok button then only the popupCanceledListener is called and the inputBox is reset. Below is the code which contains a popup with dialog and inputBox within it.

JSF code:

<af:popup contentDelivery="lazyUncached" autoCancel="enabled"
          popupCanceledListener="#{pageFlowScope.testBean.handleResetPopup}"
          childCreation="deferred" id="testPopup">
   <af:dialog type="none" modal="false"
     id="Dlg1">
     <af:inputText label="DECIMAL PLACES"
                    columns="2"
                    validator="#{pageFlowScope.testBean.validateDecimalPlaceValue}"
                    value="#{pageFlowScope.testBean.decimalPlace}"
                    id="input1" autoSubmit="true"></af:inputText>
    <f:facet name="acceptNFChange">
      <af:commandButton text="OK" id="cb1"
                        actionListener="#{pageFlowScope.testBean.handleOkFromPopup}"
                        partialSubmit="true"></af:commandButton>
    </f:facet>
  </af:dialog>
</af:popup>

Bean code:

    public void handleResetPopup(PopupCanceledEvent popupCanceledEvent) {
    try {
        UIComponent component = popupCanceledEvent.getComponent();
        RichInputText inputText = (RichInputText)JSFUtil.findComponent(component, "input1");
        inputText.resetValue();
    } catch (Throwable th) {
        this.handleException(th);
    }
}

Problem: When clicking outside the dialog to close it and reset the inputbox, the popupCanceledListener is not invoked.


Solution

  • The solution provided in this link https://community.oracle.com/thread/4112016 works fine for my scenario.