Reputation: 541
Using Primefaces 3.1.1.
I am trying to perform two actions on submit of 1 commandButton:
The original form elements are as follows:
<p:calendar ... value="#{bean.date1}" />
<p:calendar ... value="#{bean.date2}" />
<h:commandButton value="submit" onchange="TASK" action="#{Bean.saveOrUpdateItem()}" >
</h:commandButton>
But now, I would also like to achieve the following with the press of that same button:
<h:commandButton value="submit" action="#{bean.submit}">
<f:ajax execute="@form" render="result" />
</h:commandButton>
<h:outputText id="result" value="#{bean.date3}" />
Any pointers on how to deal with that? I do not want to modify the first Bean.saveOrUpdateItem() and have to create the second bean.
Thank you in advance.
-V
Upvotes: 0
Views: 121
Reputation: 11537
Try to use f:actionListener
<h:commandButton value="Submit" id="submit" action="#{myBean0.action}" >
<f:actionListener binding="#{myBean1.actionListener}"/>
<f:actionListener binding="#{myBean2.actionListener}"/>
</h:commandButton>
Upvotes: 2