Hi all,
i have a problem, when i click on save, insert new car is successfull
but validation in not working please help
<h:body>
<ui:composition>
<h:form id="tableForm">
<p:dataTable id="carTable" var="car" value="#{carBean.carList}" paginator="true" rows="10">
<p:column>
<f:facet name="header">
<h:outputText value="Name" />
</f:facet>
<h:outputText value="#{car.name}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Model" />
</f:facet>
<h:outputText value="#{car.model}" />
</p:column>
<p:column style="width:32px">
<p:commandButton update="dlgForm:display" oncomplete="carDialog.show()"
image="ui-icon ui-icon-search">
<f:setPropertyActionListener value="#{car}"
target="#{carBean.selectedCar}" />
</p:commandButton>
</p:column>
</p:dataTable>
</h:form>
<p:dialog header="Car Detail" widgetVar="carDialog" resizable="false"
width="400" showEffect="explode" hideEffect="explode">
<h:form id="dlgForm">
<h:panelGrid id="display" columns="3" cellpadding="4">
<h:outputLabel for="name" value="#{msgs.name}: *" />
<p:inputText id="name" value="#{carBean.selectedCar.name}"
required="true"/>
<p:message for="name" />
<h:outputLabel for="model" value="#{msgs.model}: *" />
<p:inputText id="model" value="#{carBean.selectedCar.model}"
required="true"/>
<p:message for="name" />
</h:panelGrid>
<p:commandButton value="save" action="#{carBean.save}" process="@form"
update="tableForm:carTable" oncomplete="carDialog.hide()"/>
</h:form>
</p:dialog>
</ui:composition>
</h:body>
P:dialog validation problem
try changing the commandbutton to:
<p:commandButton value="save" action="#{carBean.save}" process="@form"
update="tableForm:carTable @form" oncomplete="handleClose(xhr, status, args);"/>
while adding this javascript function to your page:
<p:commandButton value="save" action="#{carBean.save}" process="@form"
update="tableForm:carTable @form" oncomplete="handleClose(xhr, status, args);"/>
while adding this javascript function to your page:
Code: Select all
function handleClose(xhr, status, args) {
if (!args.validationFailed) {
carDialog.hide();
}
}
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
-
- Posts: 3
- Joined: 02 Dec 2014, 04:21
example is not there anymore
-
- Posts: 47
- Joined: 16 Jul 2013, 21:28
- Location: Gaziantep / Turkey
- Contact:
PrimeFaces 11.0.0 Community, PrimeFaces 12.0.0
Jakarta EE 9
Glassfish 6.2.5
Jakarta EE 9
Glassfish 6.2.5
-
- Information
-
Who is online
Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 43 guests