diff --git a/core/src/main/java/org/primefaces/extensions/component/inputphone/InputPhone.java b/core/src/main/java/org/primefaces/extensions/component/inputphone/InputPhone.java index db7a37491..1a2063ddc 100644 --- a/core/src/main/java/org/primefaces/extensions/component/inputphone/InputPhone.java +++ b/core/src/main/java/org/primefaces/extensions/component/inputphone/InputPhone.java @@ -123,11 +123,6 @@ public String getFamily() { return COMPONENT_FAMILY; } - @Override - public String getDefaultEventName() { - return EVENT_COUNTRY_SELECT; - } - @Override public String getInputClientId() { return getClientId() + INPUT_SUFFIX; diff --git a/core/src/main/java/org/primefaces/extensions/component/inputphone/InputPhoneRenderer.java b/core/src/main/java/org/primefaces/extensions/component/inputphone/InputPhoneRenderer.java index 63b56072c..aef83c019 100644 --- a/core/src/main/java/org/primefaces/extensions/component/inputphone/InputPhoneRenderer.java +++ b/core/src/main/java/org/primefaces/extensions/component/inputphone/InputPhoneRenderer.java @@ -21,6 +21,8 @@ */ package org.primefaces.extensions.component.inputphone; +import static org.primefaces.extensions.component.inputphone.InputPhone.EVENT_COUNTRY_SELECT; + import java.io.IOException; import java.util.Arrays; import java.util.Collection; @@ -113,7 +115,8 @@ public Object getConvertedValue(final FacesContext context, final UIComponent co else { inputPhone.setInitialCountry(country); } - if (PrimeExtensionsEnvironment.getCurrentInstance(context).isLibphonenumberAvailable()) { + if (needsValidation(context) + && PrimeExtensionsEnvironment.getCurrentInstance(context).isLibphonenumberAvailable()) { PhoneNumberUtilWrapper.validate(value, country.toUpperCase(), inputPhone.getValidatorMessage()); } else { @@ -122,6 +125,13 @@ public Object getConvertedValue(final FacesContext context, final UIComponent co return value; } + protected boolean needsValidation(final FacesContext context) { + final String eventName = context.getExternalContext() + .getRequestParameterMap() + .get(Constants.RequestParams.PARTIAL_BEHAVIOR_EVENT_PARAM); + return !EVENT_COUNTRY_SELECT.equals(eventName); + } + protected void encodeMarkup(final FacesContext context, final InputPhone inputPhone, final String valueToRender) throws IOException { final ResponseWriter writer = context.getResponseWriter();