This content has been marked as final.
Show 1 reply
-
1. Re: rich:validator : client side validator : possible to externalize the validation constraints ?
rhanus Dec 22, 2012 10:08 AM (in response to tvraghavan)depending on what you exactly mean
to externalize the validation constraints for all beans vs annotation
you may use event element of jsf core like bellow:
<f:event type="postValidate" listener="#{ourBean.myValidation}"/>
and provide validation listener in your bean code:
public void myValidation(ComponentSystemEvent e) {
UIPanel panel = (UIPanel) e.getComponent();
UIInput aInput = (UIInput) panel.findComponent("aInput");
FacesContext fc = FacesContext.getCurrentInstance();
if (aInput.getValue() == null) {
fc.addMessage(aInput.getClientId(), new FacesMessage(FacesMessage.SEVERITY_ERROR, "empty input", null));
fc.renderResponse();
return;
}
...
}