JSF - Prevent validationFailed when raising a WARN ValidatorException
- by Sébastien Tromp
Hello,
I have a form which uses validators for its fields. These validators can send back either Severity.SEVERITY_ERROR or Severity.SEVERITY_WARN messages, as illustrated:
if (!isInMainFamily) {
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_WARN, "You should make sure to tag your competency in at least one main category", null);
throw new ValidatorException(message);
}
However, SEVERITY_WARN messages are not blocking for me. They are just a way to tell the user they should correct their input, but won't prevent them from submitting the form and saving their data.
However, it seems that throwing any kind of ValidatorException flags the FacesContext as "validationFailed", which then prevents the submission of the form.
Is there a way to get around this? Or am I misunderstanding something?
Thanks a lot for your help,
Sébastien