Well, I have a problem that i don't know how to fix. I have a component (selectOneMenuFormaPagamento) that change another components.
I.E: When i choose a "selectOneMenuFormaPagamento" and click on commandButton, the others components (inside another dialog) should be updated but it's don't happen and i have no ideia why.
Look my JSF page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions">
<h:head>
</h:head>
<h:body>
<ui:composition>
<h:form id="formPagamento" enctype="multipart/form-data">
<p:dialog id="dialogPagamento" width="500px" height="90px"
header="Pagamento" widgetVar="dialogPagamento" modal="true"
showEffect="fade" hideEffect="fade">
<p:panelGrid columns="2" styleClass="semBorda">
<h:outputText value="Forma de Pagamento:" />
<p:selectOneMenu id="selectOneMenuFormaPagamento"
converter="entityConverter"
value="#{orcamentoMB.historicoPagamentoOrcamento.formaPagamento}"
effect="fade" required="true"
requiredMessage="A forma de pagamento é obrigatória">
<f:selectItem itemLabel="Selecione uma Forma de Pagamento"
itemValue="" />
<f:selectItems value="#{orcamentoMB.formasPagamento}"
var="formaPagamento" itemLabel="#{formaPagamento.descricao}"
itemValue="#{formaPagamento}" />
</p:selectOneMenu>
<p:commandButton icon="ui-icon-play" value="Continuar"
id="continuarPagamento" process="selectOneMenuFormaPagamento"
update=":formPagamento:inputTextNumeroCartao, :formPagamento:inputNumberQuantidadeParcelas, :formPagamento:selectOneMenuBandeira,
:formPagamento:valorTeste"
oncomplete="if (!args.validationFailed){ dialogPagamento.hide(); dialogPagamentoFinal.show(); }" />
</p:panelGrid>
</p:dialog>
<p:dialog id="dialogPagamentoFinal" width="500px" height="200px"
header="Pagamento" widgetVar="dialogPagamentoFinal" modal="true"
showEffect="fade" hideEffect="fade">
<p:panelGrid columns="2" styleClass="semBorda">
<h:outputText value="Valor teste" />
<p:inputText
value="#{orcamentoMB.historicoPagamentoOrcamento.formaPagamento.codigo}"
id="valorTeste" />
<h:outputText value="Valor: *" />
<pe:inputNumber
value="#{orcamentoMB.historicoPagamentoOrcamento.valor}"
symbol="R$ " required="true"
requiredMessage="O valor é obrigatório" />
<h:outputText value="Número Cartão: " />
<p:inputText id="inputTextNumeroCartao"
required="#{orcamentoMB.historicoPagamentoOrcamento.formaPagamento.codigo == 'CREDITO' or
orcamentoMB.historicoPagamentoOrcamento.formaPagamento.codigo == 'DEBITO'}"
requiredMessage="O número do cartão é obrigatório"
value="#{orcamentoMB.historicoPagamentoOrcamento.numeroCartao}"
disabled="#{orcamentoMB.historicoPagamentoOrcamento.formaPagamento.codigo != 'CREDITO' and orcamentoMB.historicoPagamentoOrcamento.formaPagamento.codigo != 'DEBITO'}" />
<h:outputText value="Quantidade Parcelas: " />
<pe:inputNumber id="inputNumberQuantidadeParcelas"
decimalPlaces="0"
required="#{orcamentoMB.historicoPagamentoOrcamento.formaPagamento.codigo == 'CREDITO'}"
requiredMessage="A quantidade de parcelas é obrigatória"
value="#{orcamentoMB.historicoPagamentoOrcamento.quantidadeParcelas}"
disabled="#{orcamentoMB.historicoPagamentoOrcamento.formaPagamento.codigo != 'CREDITO'}" />
<h:outputText value="Bandeira do Cartão: " />
<p:selectOneMenu id="selectOneMenuBandeira"
required="#{orcamentoMB.historicoPagamentoOrcamento.formaPagamento.codigo == 'CREDITO' or
orcamentoMB.historicoPagamentoOrcamento.formaPagamento.codigo == 'DEBITO'}"
requiredMessage="A Bandeira do Cartão é obrigatória"
disabled="#{orcamentoMB.historicoPagamentoOrcamento.formaPagamento.codigo != 'CREDITO' and
orcamentoMB.historicoPagamentoOrcamento.formaPagamento.codigo != 'DEBITO'}"
converter="entityConverter"
value="#{orcamentoMB.historicoPagamentoOrcamento.bandeiraCartao}"
effect="fade">
<f:selectItem itemLabel="Selecione uma Bandeira" itemValue="" />
<f:selectItems value="#{orcamentoMB.bandeiras}" var="bandeira"
itemLabel="#{bandeira.descricao}" itemValue="#{bandeira}" />
</p:selectOneMenu>
<p:commandButton icon="ui-icon-disk" value="Finalizar"
actionListener="#{orcamentoMB.finalizarPagamento}"
update=":formOrcamentos:dataTableOrcamentos"
oncomplete="if (!args.validationFailed) { dialogPagamentoFinal.hide(); }" />
</p:panelGrid>
</p:dialog>
</h:form>
</ui:composition>
</h:body>
</html>
Related
If I click on the add button (for example the "CreateCategory1" Id) to add one new product category I get the "Name field is required" validation message. This should open one dialog, where I can enter the new category name, nothing else. At this point I don't want to validate the main form, because I just want to add one new product category, which I will be using later. Why is the dialog opening validating the form? How can I avoid this?
Thank you very much!
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<ui:composition >
<h:outputScript library="js" name="warning.js"/>
<h:form id="ProductEditForm" target="_blank">
<div class="ui-fluid">
<p:panelGrid columns="4" columnClasses="ui-grid-col-6,ui-grid-col-2,ui-grid-col-2,ui-grid-col-2" layout="grid" styleClass="ui-panelgrid-blank" >
<p:outputPanel style="height: 70px" >
<p:breadCrumb model="#{breadCrumb.productMenuModel}" style="background: inherit; border: none" />
<h2>#{productController.selected.name}</h2>
</p:outputPanel>
<p:commandButton style="height: 30px; background: #{userController.headerColor}" icon="ui-icon-check" oncomplete="javascript:saved=true" action="#{productController.update}" actionListener="#{breadCrumb.navigateProduct()}" update=":center,:growl" value="#{bundle.Save}" />
<p:commandButton style="height: 30px" icon="ui-icon-close" oncomplete="javascript:saved=true" action="#{productController.refreshSelected()}" actionListener="#{breadCrumb.navigateProduct()}" update=":center,:growl" value="#{bundle.Cancel}"/>
<p:commandButton style="height: 30px" icon="ui-icon-document" update="#([id$=ProductHistoryDateForm])" oncomplete="PF('ProuctHistoryDateDialog').show()" value="Print history" disabled="#{empty productController.selected}" />
</p:panelGrid>
<p:panelGrid columns="2" columnClasses="ui-grid-col-6,ui-grid-col-6" layout="grid" >
<p:panel>
<h3>Main info</h3>
<p:panelGrid columns="2" columnClasses="ui-grid-col-3,ui-grid-col-9" layout="grid" styleClass="ui-panelgrid-blank">
<p:outputLabel value="#{bundle.EditProductLabel_name}" for="name" />
<p:inputText id="name" value="#{productController.selected.name}" title="#{bundle.EditProductTitle_name}" required="true" requiredMessage="#{bundle.EditProductRequiredMessage_name}"/>
<p:outputLabel value="#{bundle.EditProductLabel_originalName}"/>
<p:inputText id="originalName" value="#{productController.selected.originalName}"/>
<h:outputText value="#{bundle.ViewInventoryItemLabel_serialized}"/>
<p:selectBooleanCheckbox disabled="false" value="#{productController.selected.serialized}" />
<p:outputLabel value="#{bundle.EditProductLabel_ean}" for="ean" />
<p:inputText id="ean" value="#{productController.selected.ean}" title="#{bundle.EditProductTitle_ean}" />
<p:outputLabel value="#{bundle.EditProductLabel_itemNr}" for="itemNr" />
<p:inputText id="itemNr" value="#{productController.selected.itemNr}" title="#{bundle.EditProductTitle_itemNr}" />
...
</p:panelGrid>
<h3>Sales</h3>
<p:panelGrid columns="2" columnClasses="ui-grid-col-3,ui-grid-col-9" layout="grid" styleClass="ui-panelgrid-blank">
<p:outputLabel for="defaultSupplier" value="#{bundle.EditProduct_defaultSupplier}"/>
<p:selectOneMenu id="defaultSupplier" filter="true" value="#{productController.selected.defSupplierPartner}" title="#{bundle.EditProduct_defaultSupplier}" effect="fold" editable="false">
<f:selectItem itemLabel="#{bundle.SelectOneMessage}" itemValue="#{null}" noSelectionOption="true" />
<f:selectItems value="#{partnerController.items}"
var="partnerDataIdItem"
itemValue="#{partnerDataIdItem}"
itemLabel="#{partnerDataIdItem.name}"/>
</p:selectOneMenu>
<p:outputLabel value="#{bundle.EditProductLabel_purchaseDeliveryTime}" for="purchaseDeliveryTime" />
<p:inputText id="purchaseDeliveryTime" value="#{productController.selected.purchaseDeliveryTime}" title="#{bundle.EditProductTitle_purchaseDeliveryTime}" />
<p:outputLabel value="#{bundle.EditProductLabel_lastPurchase}" />
<p:inputText id="lastPurchase" value="#{productController.selected.lastPurchasePrice}" />
...
</p:panelGrid>
</p:panel>
<p:panel id ="productGroups">
<h3>Product categories</h3>
<p:panelGrid columns="3" columnClasses="ui-grid-col-1,ui-grid-col-1,ui-grid-col-11" layout="grid" styleClass="ui-panelgrid-blank">
<p:commandButton id="CreateCategory1" actionListener="#{productCategoryController.prepareCreate(1)}" update="productGroups, ProductCategoryCreateForm" icon="ui-icon-plus" oncomplete="PF('ProductCategoryCreateDialog').show()"/>
<p:commandButton id="DeleteCategory1" disabled="#{productController.selected.productCategoryId1 == null}" update="category1" actionListener="#{productCategoryController.deleteProductCategory(productController.selected.productCategoryId1)}" icon="ui-icon-minus" />
<p:selectOneMenu id="category1" value="#{productController.selected.productCategoryId1}" label="#{productController.selected.productCategoryId1.name}" effect="fold">
<f:selectItem itemLabel="#{bundle.SelectOneMessage}" itemValue="#{null}" noSelectionOption="true" />
<f:selectItems value="#{productCategoryController.getItemsByLevel(1)}"
var="item"
itemLabel="#{item.name}"/>
<p:ajax event="change" update="productGroups" listener="#{productController.changeCategory(1)}"/>
</p:selectOneMenu>
<p:commandButton id="CreateCategory2" rendered="#{productController.selected.productCategoryId1 != null}" actionListener="#{productCategoryController.prepareCreate(2)}" update="productGroups, ProductCategoryCreateForm" icon="ui-icon-plus" oncomplete="PF('ProductCategoryCreateDialog').show()"/>
<p:commandButton id="DeleteCategory2" disabled="#{productController.selected.productCategoryId2 == null}" update="category2" actionListener="#{productCategoryController.deleteProductCategory(productController.selected.productCategoryId2)}" icon="ui-icon-minus" />
<p:selectOneMenu id="category2" rendered="#{productController.selected.productCategoryId1 != null}" label="#{productController.selected.productCategoryId2.name}" value="#{productController.selected.productCategoryId2}" effect="fold">
<f:selectItem itemLabel="#{bundle.SelectOneMessage}" itemValue="#{null}" noSelectionOption="true" />
<f:selectItems value="#{productCategoryController.getItemsByLevel(2)}"
var="item"
itemLabel="#{item.name}"/>
<p:ajax event="change" update="productGroups" listener="#{productController.changeCategory(2)}"/>
</p:selectOneMenu>
<p:commandButton id="CreateCategory3" rendered="#{productController.selected.productCategoryId2 != null}" actionListener="#{productCategoryController.prepareCreate(3)}" update="productGroups, ProductCategoryCreateForm" icon="ui-icon-plus" oncomplete="PF('ProductCategoryCreateDialog').show()"/>
<p:commandButton id="DeleteCategory3" disabled="#{productController.selected.productCategoryId3 == null}" update="category3" actionListener="#{productCategoryController.deleteProductCategory(productController.selected.productCategoryId3)}" icon="ui-icon-minus" />
<p:selectOneMenu id="category3" label="#{productController.selected.productCategoryId3.name}" rendered="#{productController.selected.productCategoryId2 != null}" value="#{productController.selected.productCategoryId3}" effect="fold">
<f:selectItem itemLabel="#{bundle.SelectOneMessage}" itemValue="#{null}" noSelectionOption="true" />
<f:selectItems value="#{productCategoryController.getItemsByLevel(3)}"
var="item"
itemLabel="#{item.name}"/>
<p:ajax event="change" update="productGroups" listener="#{productController.changeCategory(3)}"/>
</p:selectOneMenu>
<p:commandButton id="CreateCategory4" rendered="#{productController.selected.productCategoryId3 != null}" actionListener="#{productCategoryController.prepareCreate(4)}" update="productGroups, ProductCategoryCreateForm" icon="ui-icon-plus" oncomplete="PF('ProductCategoryCreateDialog').show()"/>
<p:commandButton id="DeleteCategory4" disabled="#{productController.selected.productCategoryId4 == null}" update="category4" actionListener="#{productCategoryController.deleteProductCategory(productController.selected.productCategoryId4)}" icon="ui-icon-minus" />
<p:selectOneMenu id="category4" label="#{productController.selected.productCategoryId4.name}" rendered="#{productController.selected.productCategoryId3 != null}" value="#{productController.selected.productCategoryId4}" effect="fold">
<f:selectItem itemLabel="#{bundle.SelectOneMessage}" itemValue="#{null}" noSelectionOption="true" />
<f:selectItems value="#{productCategoryController.getItemsByLevel(4)}"
var="item"
itemLabel="#{item.name}"/>
<p:ajax event="change" update="productGroups" listener="#{productController.changeCategory(4)}"/>
</p:selectOneMenu>
</p:panelGrid>
</p:panel>
</p:panelGrid>
</div>
</h:form>
</ui:composition>
</html>
This is NOT a direct answer but a long extensive comment on what is all wrong with this question and how the real problem could simply be narrowed down by making a [mcve]... with a simple answer at the end.
Remove the composition
Remove the h:outputScript
Remove all styling
Remove the structural divs panelGrid and more
Remove 'bundles' from label and make them static
Remove most inputs (leave one in so that it still demonstrates the problem)
Remove most buttons that open a dialog and leave one (the one you referred to) in so that it still demonstrates the problem
What it could look like then
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:form id="ProductEditForm" target="_blank">
<p:commandButton id="CreateCategory1" actionListener="#{productCategoryController.prepareCreate(1)}" update="productGroups, ProductCategoryCreateForm" oncomplete="PF('ProductCategoryCreateDialog').show()"/>
<p:selectOneMenu id="category1" value="#{productController.selected.productCategoryId1}" label="Category 1">
<f:selectItem itemLabel="Select one" itemValue="#{null}" noSelectionOption="true" />
<f:selectItems value="#{productCategoryController.getItemsByLevel(1)}" var="item" itemLabel="#{item.name}"/>
<p:ajax event="change" update="productGroups" listener="#{productController.changeCategory(1)}"/>
</p:selectOneMenu>
<p:selectOneMenu id="category2" rendered="#{productController.selected.productCategoryId1 != null}" label="Category 2" value="#{productController.selected.productCategoryId2}" effect="fold">
<f:selectItem itemLabel="Select one" itemValue="#{null}" noSelectionOption="true" />
<f:selectItems value="#{productCategoryController.getItemsByLevel(2)}" var="item" itemLabel="#{item.name}"/>
<p:ajax event="change" update="productGroups" listener="#{productController.changeCategory(2)}"/>
</p:selectOneMenu>
</h:form>
</html>
You could even make it more simple by using plain p:inputText instead of p:selectOneMenus.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:form id="ProductEditForm" target="_blank">
<p:commandButton id="CreateCategory1" actionListener="#{productCategoryController.prepareCreate(1)}" update="productGroups, ProductCategoryCreateForm" oncomplete="PF('ProductCategoryCreateDialog').show()"/>
<p:inputText id="category1" value="#{productController.selected.productCategoryId1}" label="Category 1">
<p:ajax event="change" update="productGroups" listener="#{productController.changeCategory(1)}"/>
</p:inputText>
<p:inputText id="category2" rendered="#{productController.selected.productCategoryId1 != null}" label="Category 2" value="#{productController.selected.productCategoryId2}">
<p:ajax event="change" update="productGroups" listener="#{productController.changeCategory(2)}"/>
</p:inputText>
</h:form>
</html>
And if the problem still occurs an h:inputText with f:ajax And even an h:commandButton with an f:ajax (changing the oncomplete to onevent) , making it less PrimeFaces dependend (and still causing an error).
But now we come to it... The oncomplete that opens the dialog... Is it actually related to opening the dialog? What if you'd use a simple oncomplete="alert('Hi there');" in the commandButton? Does it fail to? 100% sure it does, so your title
Opening dialog validates the main form what I don't want
and your question
"Why is the dialog opening validating the form?"
Are both wrong... What if you remove the oncomplete completely? Still fails? Yes... Hmmmm... So it is is just related to pressing a button. Well what does a button do? It submits a form... validating it... So effectively your question becomes
"How can I prevent a commandButton from submitting and validating my whole form"
And you could also have come here by starting to remove the oncomplete in the first place, by asking yourself the question related to the title:
"IS it related to opening the dialog? What If I don't open the dialog? Where do I do that? In the oncomplete, so what if I remove that").
If you posted your new question in a search engine and added 'PrimeFaces JSF site:stackoverflow.com' to it, you'd after some reading have found:
PrimeFaces disable validation on cancel button
Which is exactly like stated in the comment. Might not be sufficient (you might need to add some other id to the process attribute of fields you do want to submit with the specific button, but you'd have a more detailed to the point question then.
You could, of course also make more than one form, submitting smaller parts
How to use <h:form> in JSF page? Single form? Multiple forms? Nested forms?
I'm working on primefaces and i can't understand this error.
My all xhtml code
My xhtml code :
<ui:composition template="/layout/template.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
>
<ui:define name="content">
<h:form id="formTab">
<p:commandButton value="Ajouter" oncomplete="PF('addNewDialog').show()" />
<p:dataTable var="tasktype" value="#{taskTypeBean.allTaskTypes}" id="taskType" selection="#{taskTypeBean.selectedTaskType}" selectionMode="single" rowKey="#{tasktype.reference}">
<p:column headerText="Reference">
<h:outputText value="#{tasktype.reference}" />
</p:column>
<p:column headerText="Description">
<h:outputText value="#{tasktype.description}" />
</p:column>
<p:column headerText="Prix Hors Taxe">
<h:outputText value="#{tasktype.htPrice}" />
</p:column>
</p:dataTable>
<p:contextMenu for="taskType">
<p:menuitem value="Modifier" action="#{taskTypeBean.updateDialog()}" update=":updateForm:udpatePanel" />
<p:menuitem value="Supprimer" action="#{taskTypeBean.deleteTaslType()}" update="taskType" />
</p:contextMenu>
</h:form>
<p:dialog widgetVar="updateDialog" modal="true" appendTo="#(body)">
<h:form id="updateForm">
<p:growl id="growlModif" showDetail="true" sticky="true" />
<p:panelGrid columns="2" id="udpatePanel">
<p:outputLabel for="reference" value="Reference :"/>
<p:inputText id="reference" required="true" requiredMessage="Entrez une reference" disabled="true" value="#{taskTypeBean.taskToUpdate.reference}"/>
<p:outputLabel for="description" value="Description :"/>
<p:inputText id="description" required="true" requiredMessage="Entrez une description" value="#{taskTypeBean.taskToUpdate.description}"/>
<p:outputLabel for="HTprice" value="HTprice :"/>
<p:inputText id="HTprice" required="true" requiredMessage="Entrez un prix hors taxe" value="#{taskTypeBean.taskToUpdate.htPrice}"/>
<p:commandButton value="Modifier" id="modifier" action="#{taskTypeBean.updateTaskType}" update=":formTab:taskType" oncomplete="PF('updateDialog').hide()" styleClass="ui-priority-primary" />
</p:panelGrid>
</h:form>
</p:dialog>
<p:dialog widgetVar="addNewDialog" modal="true" appendTo="#(body)">
<h:form>
<p:growl id="growlAdd" showDetail="true" sticky="true" />
<p:panelGrid columns="2">
<p:outputLabel for="reference" value="Reference :"/>
<p:inputText id="reference" required="true" requiredMessage="Entrez une reference" value="#{taskTypeBean.newReference}"/>
<p:outputLabel for="description" value="Description :"/>
<p:inputText id="description" required="true" requiredMessage="Entrez une description" value="#{taskTypeBean.newDescription}"/>
<p:outputLabel for="HTprice" value="HTprice :"/>
<p:inputText id="HTprice" required="true" requiredMessage="Entrez un prix hors taxe" value="#{taskTypeBean.newHTprice}"/>
<p:commandButton value="Ajouter" id="ajouter" action="#{taskTypeBean.addNewTaskType}" update=":formTab:taskType" oncomplete="PF('addNewDialog').hide()" styleClass="ui-priority-primary" />
</p:panelGrid>
</h:form>
</p:dialog>
</ui:define>
There is 3 differents form in this page
So, we can see and i have this issue :
javax.servlet.ServletException: MenuItem must be inside a form element
javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
I built this page with an template very basic, i can't understand this problem.
Thanks for your help
hello I have this page which work correctly and where I change pages dynamically
from bean with include tag:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head></h:head>
<h:body>
<p:layout fullPage="true">
<p:layoutUnit position="north" size="50" id="top">
<ui:include src="/WEB-INF/template/header.xhtml" />
</p:layoutUnit>
<p:layoutUnit position="south" size="20">
<ui:include src="/WEB-INF/template/footer.xhtml" />
</p:layoutUnit>
<p:layoutUnit position="west" size="400">
<h:form>
<f:ajax render=":centerContentPanel" execute="#this">
<h:commandLink value="page1" action="#{navigationBean.doNav}" update=":centerContentPanel">
<f:param name="test" value="/WEB-INF/pages/profil" />
</h:commandLink>
<h:commandLink value="page2" action="#{navigationBean.doNav}" process="#this">
<f:param name="test" value="/WEB-INF/pages/users" />
</h:commandLink>
</f:ajax>
</h:form>
</p:layoutUnit>
<p:layoutUnit position="center" size="400">
<h:panelGroup id="centerContentPanel">
<ui:include src="#{navigationBean.pageName}.xhtml" />
</h:panelGroup>
</p:layoutUnit>
</p:layout>
</h:body>
</html>
In the included pages I have a dialog which contain and included page also.
When I open the dialog the screen stuck and I can't change anything or press anything it become like a disabled page.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<h:form id="form">
<p:growl id="message" showDetail="true" globalOnly="true" />
<p:dataTable var="user" value="#{usersBean.users}" paginator="true"
reflow="true" widgetVar="multipleDT" resizableColumns="true"
id="multipleDT"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="5,10,15" selectionMode="single"
selection="#{usersBean.selectedUser}" rowKey="#{user.util}">
<p:ajax event="rowSelect" listener="#{usersBean.onRowSelect}"
update="b4 b3 :form:pickList :form:Submit" />
<p:ajax event="rowUnselect" listener="#{usersBean.onRowUnselect}"
update="b4 b3 :form:pickList :form:Submit" />
<p:column headerText="util" filterMatchMode="contains"
filterBy="#{user.util}" sortBy="#{user.util}" reflow="true">
<h:outputText value="#{user.util}" />
</p:column>
<p:column headerText="nom" filterMatchMode="contains"
filterBy="#{user.nom}" sortBy="#{user.nom}" reflow="true">
<h:outputText value="#{user.nom}" />
</p:column>
<p:column headerText="prenom" filterMatchMode="contains"
filterBy="#{user.prenom}" sortBy="#{user.prenom}" reflow="true">
<h:outputText value="#{user.prenom}" />
</p:column>
<p:column headerText="mail" filterMatchMode="contains"
filterBy="#{user.mail}" sortBy="#{user.mail}" reflow="true">
<h:outputText value="#{user.mail}" />
</p:column>
<f:facet name="footer">
<p:commandButton id="b3" value="ajouter"
oncomplete="PF('dlg3').show();" process="#this" ajax="true"
update="#widgetVar(dlg3) multipleDT">
</p:commandButton>
<p:commandButton id="b4" value="modifier"
disabled="#{usersBean.dis}" oncomplete="PF('dlg2').show();"
ajax="true" process="#this" update="#widgetVar(dlg2) multipleDT">
</p:commandButton>
</f:facet>
</p:dataTable>
<p:pickList id="pickList" value="#{usersBean.profilNonAffecte}"
var="Profil" itemLabel="#{Profil.libProfil}" itemValue="#{Profil}"
effect="bounce" responsive="true" showSourceFilter="true"
showTargetFilter="true" filterMatchMode="contains"
disabled="#{usersBean.dis}" style="width:50%;margin-top:20px;"
converter="primeFacesPickListConverter">
<f:facet name="sourceCaption">Available</f:facet>
<f:facet name="targetCaption">Starting</f:facet>
</p:pickList>
<p:commandButton id="Submit" value="Submit" style="margin-top:5px"
action="#{usersBean.commit}" update="pickList form:message"
disabled="#{usersBean.dis}" />
</h:form>
<h:form>
<p:dialog style="font-size:12px;" widgetVar="dlg3" resizable="false"
width="800" showEffect="explode" hideEffect="explode" modal="true"
id="dlg3" dynamic="true">
<ui:include src="/WEB-INF/pages/ajoutUser.xhtml" />
</p:dialog>
</h:form>
<h:form>
<p:dialog style="font-size:12px;" widgetVar="dlg2" resizable="false"
width="800" showEffect="explode" hideEffect="explode" modal="true"
id="dlg2" dynamic="true">
<ui:include src="/WEB-INF/pages/modifUser.xhtml" />
</p:dialog>
</h:form>
</ui:composition>
dialog code
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<h:panelGrid columns="2" id="grid">
<p:outputLabel for="ta4" value="date début :" />
<p:calendar id="ta4" value="#{usersBean.selectedUser.dateDeb}"
showOn="button" label="date début" required="true"
binding="#{startDateComponent}" pattern="dd/MM/yyyy" navigator="true">
<p:message for="ta4" />
<p:ajax event="dateSelect" listener="#{usersBean.onDateSelect}"
update="ta4" />
</p:calendar>
<p:outputLabel for="ta5" value="date fin :" />
<p:calendar id="ta5" value="#{usersBean.selectedUser.dateFin}"
showOn="button" label="date fin" required="true" pattern="dd/MM/yyyy"
mode="popup">
<f:validator validatorId="dateRangeValidator" />
<f:attribute name="startDateComponent" value="#{startDateComponent}" />
<p:message for="ta5" />
</p:calendar>
<p:outputLabel for="ta6" value="nom :" label="nom" />
<p:inputText rows="6" cols="33" id="ta6"
value="#{usersBean.selectedUser.nom}" required="true">
<p:message for="ta6" />
</p:inputText>
<p:outputLabel for="ta7" value="prénom :" />
<p:inputText rows="6" cols="33" id="ta7"
value="#{usersBean.selectedUser.prenom}" required="true"
label="prenom">
<p:message for="ta7" />
</p:inputText>
<p:outputLabel for="ta8" value="mail :" />
<p:inputText rows="6" cols="33" id="ta8"
value="#{usersBean.selectedUser.mail}" required="true" label="mail"
validatorMessage="email format error ">
<f:validateRegex
pattern="^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*#[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$" />
<p:message for="ta8" />
</p:inputText>
<p:outputLabel for="chk" value="Valid :" />
<p:selectBooleanCheckbox value="#{usersBean.selectedUser.valid}"
id="chk" />
<p:commandButton value="confirmer" id="ajax"
actionListener="#{usersBean.modifier}"
styleClass="ui-priority-primary" update="grid form:message form:multipleDT" >
</p:commandButton>
</h:panelGrid>
</ui:composition>
i find it the problem was modal="true" in the dialog
This question already has an answer here:
Manually adding / loading jQuery with PrimeFaces results in Uncaught TypeErrors
(1 answer)
Closed 7 years ago.
I'm having an unusual problem with a page which contains a Tree on the left, and a TabView on the right. I have implemented 2 tabs so far. If the first tab is "Profile", then the 2nd tab, "Users" does not display (the tab title is there, but when selected there is no content under the tab). If I switch the order and put "Users" first, then both tabs display.
I tried changing the content on "Users" - I first used an accordionPanel, then thought perhaps the tabs on TabView and Accordion were getting confused and changed it to a dataList. The content in the "Users" panel doesn't seem to matter.
I'll show the xhtml code when it works, and when it doesn't.
Users panel does not show:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:rich="http://richfaces.org/rich"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:p="http://primefaces.org/ui"
xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
xmlns:cust="http://memarden.com">
<link href="CSS/navigation.css" rel="stylesheet" type="text/css" />
<h:body>
<h3>#{text['organization']}</h3>
<ui:composition template="template-restricted.xhtml">
<ui:define name="body_content">
<h:form id="mainForm">
<div id="title" class="sl-title">Manage Schools - #{manageOrgHierarchy.selectedOrganization.displayString}</div>
<div class="sr-content">
<div class="ui-grid ui-grid-responsive"><div class="ui-grid-row">
<div class="ui-grid-col-4"><p:panel layout="block">
<p:toolbar><f:facet name="left">
<p:commandButton
title="New Root Org"
icon="fa fa-folder-open"
rendered="#{userSession.isAdmin}"
process="#form"
update="#form"
action="#{manageOrgHierarchy.createNewRootOrg}" />
<p:commandButton
title="#{text['new.item']}"
icon="fa fa-folder-open"
process="#form"
update="#form"
action="#{manageOrgHierarchy.createNewSubOrg}" />
<p:commandButton
title="#{text['delete']}"
icon="fa fa-trash"
process="#form"
update="#form"
disabled="#{not manageOrgHierarchy.canBeDeleted}"
action="#{manageOrgHierarchy.delete}" />
<p:commandButton
title="#{text['save']}"
icon="fa fa-save"
process="#form"
update="#form"
action="#{manageOrgHierarchy.save}" />
</f:facet></p:toolbar>
<p:tree
id="orgTree"
value="#{manageOrgHierarchy.rootNodes}"
selectionMode="single"
selection="#{manageOrgHierarchy.selectedNode}"
style="ui-grid-col-2"
var="node">
<p:ajax event="select" update="mainForm" listener="#{manageOrgHierarchy.nodeSelected}" />
<p:ajax event="unselect" update="mainForm" listener="#{manageOrgHierarchy.nodeUnselected}" />
<p:ajax event="expand" listener="#{manageOrgHierarchy.nodeExpanded}" />
<p:ajax event="collapse" listener="#{manageOrgHierarchy.nodeCollapsed}" />
<p:treeNode type="OrganizationHierarchy">
<h:outputText value="#{node.nickName}" />
</p:treeNode>
</p:tree></p:panel>
</div>
<div class="ui-grid-col-8">
<p:tabView>
<p:tab title="#{text['profile']}">
<p:panelGrid columns="2" layout="grid">
<p:panelGrid columns="1" layout="grid">
<p:outputLabel for="name" value="#{text['name']}" />
<p:inputText id="name" value="#{manageOrgHierarchy.editOrg.nickName}" />
</p:panelGrid>
<p:panelGrid columns="1" layout="grid">
<p:outputLabel for="phone" value="#{text['phone']}" />
<p:inputText id="phone" value="#{manageOrgHierarchy.editOrg.phone}" />
</p:panelGrid>
<p:panelGrid columns="1" layout="grid">
<p:outputLabel for="address" value="#{text['address']}" />
<p:inputText id="address" value="#{manageOrgHierarchy.editOrg.address}" />
</p:panelGrid>
<p:panelGrid columns="1" layout="grid">
<p:outputLabel for="city" value="#{text['city']}" />
<p:inputText id="city" value="#{manageOrgHierarchy.editOrg.city}" />
</p:panelGrid>
<p:panelGrid columns="1" layout="grid">
<p:outputLabel for="state" value="#{text['state']}" />
<p:inputText id="state" value="#{manageOrgHierarchy.editOrg.state}" />
</p:panelGrid>
<p:panelGrid columns="1" layout="grid">
<p:outputLabel for="postalCode" value="#{text['post.code']}" />
<p:inputText id="postalCode" value="#{manageOrgHierarchy.editOrg.postalCode}" />
</p:panelGrid>
<p:panelGrid columns="1" layout="grid">
<p:outputLabel for="country" value="#{text['address.country']}" />
<p:inputText id="country" value="#{manageOrgHierarchy.editOrg.country}" />
</p:panelGrid>
</p:panelGrid>
<h:panelGroup>
<p:commandButton
value="#{text['cancel']}"
icon="fa fa-trash"
process="#form"
update="#form"
action="#{manageOrgHierarchy.cancelEditOrg}" />
<p:commandButton
value="#{text['save']}"
icon="fa fa-save"
process="#form"
update="#form"
action="#{manageOrgHierarchy.saveEditOrg}" />
</h:panelGroup>
</p:tab>
<p:tab title="#{text['users']}">
<p:dataList value="#{manageOrgHierarchy.userPermissions}" var="p">
<p:panelGrid columns="2">
<cust:avatarOutput owner="#{p.user}" session="#{userSession}"/>
<p:panelGrid columns="1">
<h:outputText value="#{p.user.displayString}" />
<h:outputText value="#{p.user.name}" />
</p:panelGrid>
</p:panelGrid>
</p:dataList>
</p:tab>
<p:tab title="#{text['lessons']}"></p:tab>
<p:tab title="#{text['reports']}"></p:tab>
</p:tabView></div></div></div>
</div>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
Both panels work:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:rich="http://richfaces.org/rich"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:p="http://primefaces.org/ui"
xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
xmlns:cust="http://memarden.com">
<link href="CSS/navigation.css" rel="stylesheet" type="text/css" />
<h:body>
<h3>#{text['organization']}</h3>
<ui:composition template="template-restricted.xhtml">
<ui:define name="body_content">
<h:form id="mainForm">
<div id="title" class="sl-title">Manage Schools - #{manageOrgHierarchy.selectedOrganization.displayString}</div>
<div class="sr-content">
<div class="ui-grid ui-grid-responsive"><div class="ui-grid-row">
<div class="ui-grid-col-4"><p:panel layout="block">
<p:toolbar><f:facet name="left">
<p:commandButton
title="New Root Org"
icon="fa fa-folder-open"
rendered="#{userSession.isAdmin}"
process="#form"
update="#form"
action="#{manageOrgHierarchy.createNewRootOrg}" />
<p:commandButton
title="#{text['new.item']}"
icon="fa fa-folder-open"
process="#form"
update="#form"
action="#{manageOrgHierarchy.createNewSubOrg}" />
<p:commandButton
title="#{text['delete']}"
icon="fa fa-trash"
process="#form"
update="#form"
disabled="#{not manageOrgHierarchy.canBeDeleted}"
action="#{manageOrgHierarchy.delete}" />
<p:commandButton
title="#{text['save']}"
icon="fa fa-save"
process="#form"
update="#form"
action="#{manageOrgHierarchy.save}" />
</f:facet></p:toolbar>
<p:tree
id="orgTree"
value="#{manageOrgHierarchy.rootNodes}"
selectionMode="single"
selection="#{manageOrgHierarchy.selectedNode}"
style="ui-grid-col-2"
var="node">
<p:ajax event="select" update="mainForm" listener="#{manageOrgHierarchy.nodeSelected}" />
<p:ajax event="unselect" update="mainForm" listener="#{manageOrgHierarchy.nodeUnselected}" />
<p:ajax event="expand" listener="#{manageOrgHierarchy.nodeExpanded}" />
<p:ajax event="collapse" listener="#{manageOrgHierarchy.nodeCollapsed}" />
<p:treeNode type="OrganizationHierarchy">
<h:outputText value="#{node.nickName}" />
</p:treeNode>
</p:tree></p:panel>
</div>
<div class="ui-grid-col-8">
<p:tabView>
<p:tab title="#{text['users']}">
<p:dataList value="#{manageOrgHierarchy.userPermissions}" var="p">
<p:panelGrid columns="2">
<cust:avatarOutput owner="#{p.user}" session="#{userSession}"/>
<p:panelGrid columns="1">
<h:outputText value="#{p.user.displayString}" />
<h:outputText value="#{p.user.name}" />
</p:panelGrid>
</p:panelGrid>
</p:dataList>
</p:tab>
<p:tab title="#{text['profile']}">
<p:panelGrid columns="2" layout="grid">
<p:panelGrid columns="1" layout="grid">
<p:outputLabel for="name" value="#{text['name']}" />
<p:inputText id="name" value="#{manageOrgHierarchy.editOrg.nickName}" />
</p:panelGrid>
<p:panelGrid columns="1" layout="grid">
<p:outputLabel for="phone" value="#{text['phone']}" />
<p:inputText id="phone" value="#{manageOrgHierarchy.editOrg.phone}" />
</p:panelGrid>
<p:panelGrid columns="1" layout="grid">
<p:outputLabel for="address" value="#{text['address']}" />
<p:inputText id="address" value="#{manageOrgHierarchy.editOrg.address}" />
</p:panelGrid>
<p:panelGrid columns="1" layout="grid">
<p:outputLabel for="city" value="#{text['city']}" />
<p:inputText id="city" value="#{manageOrgHierarchy.editOrg.city}" />
</p:panelGrid>
<p:panelGrid columns="1" layout="grid">
<p:outputLabel for="state" value="#{text['state']}" />
<p:inputText id="state" value="#{manageOrgHierarchy.editOrg.state}" />
</p:panelGrid>
<p:panelGrid columns="1" layout="grid">
<p:outputLabel for="postalCode" value="#{text['post.code']}" />
<p:inputText id="postalCode" value="#{manageOrgHierarchy.editOrg.postalCode}" />
</p:panelGrid>
<p:panelGrid columns="1" layout="grid">
<p:outputLabel for="country" value="#{text['address.country']}" />
<p:inputText id="country" value="#{manageOrgHierarchy.editOrg.country}" />
</p:panelGrid>
</p:panelGrid>
<h:panelGroup>
<p:commandButton
value="#{text['cancel']}"
icon="fa fa-trash"
process="#form"
update="#form"
action="#{manageOrgHierarchy.cancelEditOrg}" />
<p:commandButton
value="#{text['save']}"
icon="fa fa-save"
process="#form"
update="#form"
action="#{manageOrgHierarchy.saveEditOrg}" />
</h:panelGroup>
</p:tab>
<p:tab title="#{text['lessons']}"></p:tab>
<p:tab title="#{text['reports']}"></p:tab>
</p:tabView></div></div></div>
</div>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
This was caused by unrelated javascript in a menu section which declared a jquery.js library. When I removed the offending import, all of the strange Primefaces errors went away. It seems declaring other jquery libraries interferes with Primefaces code.
Well, my problem is that no dialog inside my main page is called. I.E: I have a commandButton should call "varDialogFindPacientes" but don't work. I don't know what can i do to fix it.
Look my main page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions">
<h:head>
</h:head>
<h:body>
<ui:composition>
<p:dialog id="dialogCadastrar" width="900px" height="500px"
header="Cadastrar Orçamento" widgetVar="varDialogCadastrar"
modal="true" showEffect="fade" hideEffect="fade">
<h:form id="formCadastrar">
<p:panelGrid id="panelGridCadastar" styleClass="semBorda"
columns="2">
<h:outputText value="Data Emissão: " />
<p:inputText id="dataEmissao"
value="#{orcamentoMB.orcamento.dataEmissao}" readonly="true">
<f:convertDateTime pattern="dd/MM/yyyy" />
</p:inputText>
<h:outputText value="Data Validade: " />
<p:inputText id="dataValidade"
value="#{orcamentoMB.orcamento.dataValidade}" readonly="true">
<f:convertDateTime pattern="dd/MM/yyyy" />
</p:inputText>
<h:outputText value="Situação " />
<p:inputText id="situacao"
value="#{orcamentoMB.orcamento.situacao.descricao}"
readonly="true" />
<h:outputText value="Desconto (%): " />
<p:panelGrid columns="2" styleClass="semBorda">
<pe:inputNumber value="#{orcamentoMB.orcamento.desconto}"
id="desconto" symbol=" %" symbolPosition="suffix"
validatorMessage="O desconto não pode ser maior que #{orcamentoMB.maxDesconto} %">
<f:validateDoubleRange maximum="#{orcamentoMB.maxDesconto}" />
</pe:inputNumber>
<p:commandButton value="Recalcular" process="desconto"
icon="ui-icon-refresh"
update=":formCadastrar:totalGeral, :formCadastrar:totalGeralComDesconto" />
</p:panelGrid>
<h:outputText value="Observação: " />
<p:inputTextarea value="#{orcamentoMB.orcamento.observacoes}"
rows="5" cols="30" />
<h:outputText value="Dentista: *" />
<p:panel style="border:1px solid #e5e5e5;">
<p:inputText required="true"
requiredMessage="Selecione um dentista"
value="#{orcamentoMB.orcamento.dentistaOrcou.pessoaFisica.nome}"
readonly="true" size="30" id="dentistaOrcou" />
<p:commandButton icon="ui-icon-search" type="button"
onclick="varDialogFindDentistas.show()" />
</p:panel>
<h:outputText value="Paciente *" />
<p:panel style="border:1px solid #e5e5e5;">
<p:inputText required="true"
requiredMessage="Selecione um paciente"
value="#{orcamentoMB.orcamento.paciente.pessoaFisica.nome}"
readonly="true" size="30" id="paciente" />
<p:commandButton icon="ui-icon-search" type="button"
onclick="varDialogFindPacientes.show()" />
</p:panel>
</p:panelGrid>
<p:toolbar>
<p:toolbarGroup align="left">
<p:commandButton value="Add" icon="ui-icon-plus"
onclick="varDialogFindItensTabela.show()" type="button"
update=":formCadastrar:dataTableItens, :formCadastrar:salvarAceitando,:formCadastrar:salvarSemAceitar, :formCadastrar:totalGeral,
:formCadastrar:totalGeralComDesconto" />
<p:commandButton value="Del" icon="ui-icon-minus"
disabled="#{orcamentoMB.selectedItemOrcamento == null}"
actionListener="#{orcamentoMB.delItemOrcamento}"
update=":formCadastrar:dataTableItens, :formCadastrar:totalGeral,
:formCadastrar:totalGeralComDesconto, :formCadastrar:salvarAceitando,:formCadastrar:salvarSemAceitar" />
</p:toolbarGroup>
</p:toolbar>
<p:dataTable rowKey="#{item}" var="item"
value="#{orcamentoMB.itens}"
emptyMessage="Não foi encontrado nenhum registro"
id="dataTableItens"
selection="#{orcamentoMB.selectedItemOrcamento}"
selectionMode="single" rowIndexVar="rowIndex"
rowStyleClass="#{(rowIndex mod 2) eq 0 ? 'first-row' : 'second-row'}">
<p:column headerText="Nome"
sortBy="#{item.itemTabelaProcedimento.procedimento.nome}"
id="nome">
<h:outputText
value="#{item.itemTabelaProcedimento.procedimento.nome}" />
</p:column>
<p:column headerText="Valor"
sortBy="#{item.itemTabelaProcedimento.valor}" id="valor">
<h:outputText value="#{item.itemTabelaProcedimento.valor}">
<f:convertNumber currencySymbol="R$ " type="currency" />
</h:outputText>
</p:column>
<p:column headerText="Local Aplicação"
sortBy="#{item.localAplicacao.descricao}" id="localAplicacao">
<h:outputText value="#{item.localAplicacao.descricao}" />
</p:column>
<p:column headerText="Dente" sortBy="#{item.dente.descricao}"
id="dente">
<h:outputText value="#{item.dente.descricao}" />
</p:column>
<p:column headerText="Face"
sortBy="#{item.faceAplicacao.descricao}" id="face">
<h:outputText value="#{item.faceAplicacao.descricao}" />
</p:column>
</p:dataTable>
<p:panelGrid columns="2">
<h:outputText value="Total Geral: " />
<h:outputText value="#{orcamentoMB.totalGeral}" id="totalGeral">
<f:convertNumber currencySymbol="R$ " type="currency" />
</h:outputText>
<h:outputText value="Total Com Desconto: " />
<h:outputText value="#{orcamentoMB.totalGeralComDesconto}"
id="totalGeralComDesconto">
<f:convertNumber currencySymbol="R$ " type="currency" />
</h:outputText>
</p:panelGrid>
<p:toolbar>
<p:toolbarGroup align="left">
<p:commandButton icon="ui-icon-disk" value="Salvar Sem Aceitar"
id="salvarSemAceitar" disabled="#{orcamentoMB.itens.size() == 0}"
actionListener="#{orcamentoMB.salvar}"
oncomplete="if (!args.validationFailed){ varDialogCadastrar.hide() }"
update=":formOrcamentos:dataTableOrcamentos">
<f:attribute name="salvarAceitando" value="false" />
</p:commandButton>
<p:commandButton icon="ui-icon-disk" value="Salvar Aceitando"
id="salvarAceitando" disabled="#{orcamentoMB.itens.size() == 0}"
actionListener="#{orcamentoMB.salvar}"
oncomplete="if (!args.validationFailed){ varDialogCadastrar.hide() }"
update=":formOrcamentos:dataTableOrcamentos">
<f:attribute name="salvarAceitando" value="true" />
</p:commandButton>
<p:commandButton value="Cancelar" icon="ui-icon-close"
onclick="varDialogCadastrar.hide()" type="button" />
</p:toolbarGroup>
</p:toolbar>
</h:form>
</p:dialog>
</ui:composition>
</h:body>
</html>
So, i'll show a page the is called for "varDialogFindPacientes"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<ui:composition>
<p:dialog id="dialogFindPacientes" width="600px" height="auto"
header="Pesquisar Pacientes" widgetVar="varDialogFindPacientes"
modal="true" showEffect="fade" hideEffect="fade">
<h:form id="formFindPacientes">
<p:dataTable rowKey="#{paciente.id}" var="paciente"
value="#{orcamentoMB.pacientes}" paginator="true"
emptyMessage="Não foi encontrado nenhum registro" rows="20"
id="dataTablePacientes" selection="#{orcamentoMB.selectedPaciente}"
selectionMode="single" rowIndexVar="rowIndex"
rowStyleClass="#{(rowIndex mod 2) eq 0 ? 'first-row' : 'second-row'}"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}">
<p:ajax event="rowDblselect" process="dataTablePacientes"
listener="#{orcamentoMB.updatePacienteFromFind}"
oncomplete="dialogFindPacientes.hide()"
update=":formCadastrar:paciente" />
<p:column headerText="Nome" sortBy="#{paciente.pessoaFisica.nome}"
filterBy="#{paciente.pessoaFisica.nome}" id="nome"
filterMatchMode="contains">
<h:outputText value="#{paciente.pessoaFisica.nome}" />
</p:column>
</p:dataTable>
</h:form>
</p:dialog>
</ui:composition>
</h:body>
</html>
EDIT 1:
I have another problem yet, the #PostConstruct from my ManagedBean is called every ajax call.