JSF - Prevent validationFailed when raising a WARN ValidatorException
Posted
by
Sébastien Tromp
on Stack Overflow
See other posts from Stack Overflow
or by Sébastien Tromp
Published on 2010-12-31T13:49:08Z
Indexed on
2010/12/31
13:54 UTC
Read the original article
Hit count: 304
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
© Stack Overflow or respective owner