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.