public static void init(WebApplication application) { application.getComponentPreOnBeforeRenderListeners().add(PRE_ON_BEFORE_RENDER_LISTENER); application.getComponentPostOnBeforeRenderListeners().add(POST_ON_BEFORE_RENDER_LISTENER); application.getComponentOnAfterRenderListeners().add(ON_AFTER_RENDER_LISTENER); application.getAjaxRequestTargetListeners().add(AJAX_LISTENER); FormProcessedListener.init(application); }
@Override public void component(FormComponent<?> formComponent, IVisit<Void> visit) { if (hasError(formComponent)) { Form<?> formToRefresh = FormProcessedListener.findProcessedForm(formComponent); // If the form has not been processed, isValid() always returns false, but // in our case we'd like to consider the formComponent as valid. if (formToRefresh != null) { target.add(formToRefresh); if (!formToRefresh.getBehaviors().contains(PROPAGATE_HAS_ERROR_BEHAVIOR)) { formToRefresh.add(PROPAGATE_HAS_ERROR_BEHAVIOR); } } } }