p:commandButton actionListener

UI Components for JSF
Post Reply
tkernstock
Posts: 65
Joined: 29 Jun 2010, 14:39
Location: Vienna, Austria

31 Oct 2010, 02:10

Hi,

I had a problem today with the p:commandButton used in a dialog - the actionListener method wasn't called !

Code: Select all

<p:dialog header="#{msgs.kennwort_welcome}" widgetVar="dlgChangepassword" modal="true" >
			<p:growl id="growl" showDetail="true" life="3000" /> 
		   	<h:form id="changePasswordForm">
       			<h:panelGrid id="changePassword" columns="2" style="border:2px" >
       				<h:outputLabel for="kennwort"  value="#{msgs.kennwort_neuesKennwort}" />
					<h:inputSecret id="kennwort" value="#{kontoeinstellungenBean.kennwort}" />
					<h:outputLabel for="kennwort2"  value="#{msgs.kennwort_neuesKennwort2}" />
					<h:inputSecret id="kennwort2" value="#{kontoeinstellungenBean.kennwort2}" />
       			</h:panelGrid>
       			<p:commandButton value="#{msgs.button_change}" update="growl" actionListener="#{kontoeinstellungenBean.changePassword}" oncomplete="dlgChangepassword.hide();"/>
       		</h:form>
		</p:dialog>
When I remove the <form> tag the actionListener method is called !

Code: Select all

<p:dialog header="#{msgs.kennwort_welcome}" widgetVar="dlgChangepassword" modal="true" >
			<p:growl id="growl" showDetail="true" life="3000" /> 
		   	
       			<h:panelGrid id="changePassword" columns="2" style="border:2px" >
       				<h:outputLabel for="kennwort"  value="#{msgs.kennwort_neuesKennwort}" />
					<h:inputSecret id="kennwort" value="#{kontoeinstellungenBean.kennwort}" />
					<h:outputLabel for="kennwort2"  value="#{msgs.kennwort_neuesKennwort2}" />
					<h:inputSecret id="kennwort2" value="#{kontoeinstellungenBean.kennwort2}" />
       			</h:panelGrid>
       			<p:commandButton value="#{msgs.button_change}" update="growl" actionListener="#{kontoeinstellungenBean.changePassword}" oncomplete="dlgChangepassword.hide();"/>
       		
		</p:dialog>
Is this a bug or a feature :-) ? I couldn't find that behaviour mentioned in the doku though !

best regards
Thomas
Using: Eclipse 2020-06, Java 8, Primefaces 8, Omnifaces 3.6.1, Payara Server 5.201, Deltaspike 1.8.2

callahan
Posts: 768
Joined: 27 May 2010, 22:52

31 Oct 2010, 12:19

HI,

Are you using nested forms? This should be avoided.

tkernstock
Posts: 65
Joined: 29 Jun 2010, 14:39
Location: Vienna, Austria

31 Oct 2010, 13:27

Hi,

you are right - I included the dialog component in another form - so they where nested !

Thanks for your help !

Thomas
Using: Eclipse 2020-06, Java 8, Primefaces 8, Omnifaces 3.6.1, Payara Server 5.201, Deltaspike 1.8.2

callahan
Posts: 768
Joined: 27 May 2010, 22:52

31 Oct 2010, 13:35

No problem ;).

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 33 guests