0
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" />
The messages of required="true"
of inpuText
work perfectly.
But when processing a commit in 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 cannot get the message to appear. Mine messages
is an extended class of Facesmessages and in it when executed:
messages.error()
or messages.info()
- parameter is sent (below the implementation)
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>
Follow the code where the 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>
painel-dialog
is the dialog id or a panel inside it?– Rafael
Rafael is a
<p:panelGrid>
, of dialogue isitem-dialog
.– Marcelo Gomes
From what I see the problem may be in this oncomplete, I think it is closing regardless of its condition. You have tried to close just by your bean?
– Rafael