1
I am trying to open the dialog of the first faces, but without success. I have the following code:
Clientescadastrados.xhtml:
...
<ui:define name="content">
<h:form id="frm-clientes-cadastrados">
<p:button value="Novo Cliente" styleClass="btn-cadastrar" onclick="cadastroClienteDialog.show(); return false;" />
<p:dataTable var="cliente" value=...>
...
</p:dataTable>
</h:form>
</ui:define>
<h:form id="frm-cadastro-cliente-dialog">
<p:dialog header="Cadastrar Cliente" widgetVar="cadastroClienteDialog" modal="true">
Conteúdo
</p:dialog>
</h:form>
In the browser console the following error:
Uncaught Referenceerror: cadastroClienteDialog is not defined at Htmlbuttonelement.onclick (Customersdastrados.xhtml:31)
If I’m not mistaken, in
onclick
from the button you need to reference the form in which the dialog is. Something like:onclick=":frm-cadastro-cliente-dialog:cadastroClienteDialog.show()"
– igventurelli