I have a processing of a <p:dialog>
within this dialog I have a <p:messages>
.
<p:messages id="msg-dialog" showDetail="true" autoUpdate="true" closable="true" />
Messages from required="true"
of inpuText
work perfectly.
But when processing a submission in the Bean for example:
if (!ValidaCPF.isCPF(itemEdicao.getCpf())) {
itemEdicao.setSituacao("I");
messages.error("CPF Inválido!");
msgErro = "CPF Inválido";
RequestContext.getCurrentInstance().update(Arrays.asList("frm:msg-dialog","frm:itens-table"));
}
I can not get the message to appear. My messages
is an extended class of FacesMessages and in it when I execute:
messages.error()
or messages.info()
- the parameter (below the implementation) is sent
public void info(String message) {
add(message, FacesMessage.SEVERITY_INFO);
}
public void error(String message) {
add(message, FacesMessage.SEVERITY_ERROR);
}
How do I make xhtml recognize the error and do not close <p:dialog>
Here is the code where hide
is executed:
<p:commandButton id="btn-salvar" value="Salvar"
action="#{solicitacaoRHBean.salvarItem()}" process="item-dialog"
disabled="#{solicitacaoRHBean.id == null}"
oncomplete="if (! args.validationFailed) PF('edicaoItemDialog').hide()"
update="msg-dialog painel-dialog itens-table">
</p:commandButton>