P:dialog validation problem

UI Components for JSF
Post Reply
tasmanian.devil
Posts: 7
Joined: 16 Mar 2011, 19:38

17 Mar 2011, 01:36

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>

robert.m
Posts: 226
Joined: 07 Dec 2010, 22:52
Location: Salzburg/Austria

17 Mar 2011, 13:35

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:

Code: Select all

function handleClose(xhr, status, args) {
	if (!args.validationFailed) {
		carDialog.hide();
	}
}


mireczatko
Posts: 3
Joined: 02 Dec 2014, 04:21

16 Feb 2015, 12:33

optimus.prime wrote:Live example is at;

http://www.primefaces.org/showcase/ui/dialogLogin.jsf
example is not there anymore

kurtomerfaruk
Posts: 47
Joined: 16 Jul 2013, 21:28
Location: Gaziantep / Turkey
Contact:

18 Feb 2015, 17:30

PrimeFaces 11.0.0 Community, PrimeFaces 12.0.0
Jakarta EE 9
Glassfish 6.2.5

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 43 guests