Question

I use client-side validation with JSR-303 (bean validation) constraints as in the Richfaces 4 showcase

http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=clientValidation&sample=jsr303&skin=blueSky

If I add a validation constraint in the validation bean like

@Pattern(regexp = "^[\\w\\-]([\\.\\w])+[\\w]+@([\\w\\-]+\\.)+[a-zA-Z]{2,4}$", message = "Bad email")
private String email;  

an error message would be triggered.

How can I trigger infos etc with client side validation like I would do in case of server side validation with a bean method like

public void validateEmail(FacesContext context, UIComponent toValidate, Object value) {
   ...
   ((UIInput) toValidate).setValid(true);
   FacesMessage message = new FacesMessage("Looks good!");
   message.setSeverity(message.SEVERITY_INFO);
   context.addMessage(toValidate.getClientId(context), message);
   ...
}   

Thanks!

Was it helpful?

Solution

There is currently no way to set the severity of a RichFaces CSV message. You'll have to file a feature request via jira requesting such a feature:

https://issues.jboss.org/browse/RF

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top