form in <p:dialog is submitted although dialog is not active

UI Components for JSF
Post Reply
hwiesner
Posts: 9
Joined: 06 Mar 2015, 12:37

12 Mar 2015, 13:46

Hello,

i have a form in a dialog:

Code: Select all

		<p:dialog id="addTollChargeWrapper" widgetVar="addTollChargeWrapperWV">
			<h:form>
				<p:panelGrid id="addTollChargeWrapperPG" columns="2">
					<f:facet name="header">Mautbereich anlegen</f:facet>
When the main page is rendered, the dialog is rendered too, although the dialog is not visible.
This leads to errornous behaviour in my Controller.
How can i render the form only if the dialog is visible - when onclick="PF('addTollChargeWrapperWV').show();" - has been called before
and the user has filled the form.

best regards

Heiko
Primefaces 5.1, Mojarra 2.2.8-jbossorg-1 20140822-1131, Wildfly 8.2.0, jdk1.8.0_31_amd64

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

12 Mar 2015, 14:43

use the visible flag on the dialog - set the flag to true and update the dialog via commandButton instead calling .show() on the widget.
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

hwiesner
Posts: 9
Joined: 06 Mar 2015, 12:37

12 Mar 2015, 15:38

thank you for the reply.
The Problem is, that the button from the main form is executed at the initial rendering phase.
I also tried the onklick method, but this is also executed at the rendering phase.

Code: Select all

<p:commandButton id="btnNewTollChargeWrapper" value="neue Mautzone"
						ajax="true" update=":tollChargeForm:tollCharges">
						<f:ajax event="click"
							execute="#{tollChargeController.setCreateMode(true)}; PF('addTollChargeWrapperWV').show();"></f:ajax>
</p:commandButton>
how can i avoid the execution without a click?

best regards

Heiko
Primefaces 5.1, Mojarra 2.2.8-jbossorg-1 20140822-1131, Wildfly 8.2.0, jdk1.8.0_31_amd64

hwiesner
Posts: 9
Joined: 06 Mar 2015, 12:37

25 Apr 2015, 12:11

for others with the same problem:

the solution is to use <p:ajax instead of <f:ajax

<p:commandButton does not work with <f:ajax

best regards

Heiko
Primefaces 5.1, Mojarra 2.2.8-jbossorg-1 20140822-1131, Wildfly 8.2.0, jdk1.8.0_31_amd64

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 36 guests