Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

ADF popup cancel listener not invoked on closing dialog with validation errors

Vivek Sridhar-OracleJan 10 2018 — edited Jan 11 2018

The issue is when I enter some negative value in the inputBox and the validator method throws an 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. If I press Esc key or Ok button then only the popupCanceledListener is called and the inputBox is reset.

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);
 
}
}

Note: validator method validateDecimalPlaceValue()will check if negative value is entered or not in the inputBox and throw validation error if required.

Comments

Timo Hahn

Then remove the autoCancel from the pop-up. Then the pop-up only closed when the user clicks on OK or cancel.

Timo

Vivek Sridhar-Oracle

Hi Timo, This is dialog within popup which has only ok button. The listener gets invoked if the user clicks on OK button or press Esc key to close the dialog when it has focus. When user decides to close the dialog by just clicking outside the dialog the cancel listener does not gets invoked. I am trying to resolve the issue of clicking outside and invoking the listener.

Timo Hahn

I understand that. However, if this will not work, removing the autocancel from the popup will work.

Which exact 11g version do you use?

Do you have a property resetEditableValues on the popup?

If yes set it to whenCanceled. Maybe this helps.

Timo

Vivek Sridhar-Oracle
  • JDEV Studio Edition Version 11.1.1.7.0
  • Build JDEVADF_11.1.1.7.0_GENERIC_130226.1400.6493
  • ADF Business Components 11.1.1.65.57
  • Java(TM) Platform 1.8.0_151
  • Oracle IDE 11.1.1.7.40.64.93
  • Versioning Support 11.1.1.7.40.64.93

I do not have the resetEditableValues property in popup or dialog.

dvohra21

Refer "How to auto-dismiss af:popup dialogs"

"The two use cases for the af:popup are to show content

for edit or for information. In the latter case you may want

to implement a functionality that auto-hides a popup after

a certain period of time. Users should have the option to

close the popup by pressing a close icon, a close button,

or by a click outside of the popup."

Vivek Sridhar-Oracle

I had to set autoCancel to disabled and programmatically have to close the popup. This is the nearest solution I could find from the Frank's blog on  "How to auto-dismiss af:popup dialogs". Because, I do not have the resetEditableValues property for the popup based on my JDev version and I could not upgrade due to the team project compliance issues. Thanks Tim and DVOHRA21 for your help.

1 - 6
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Feb 8 2018
Added on Jan 10 2018
6 comments
2,557 views