primefaces p:commandButton action not redirecting when in a p:dialog
Posted
by
John
on Stack Overflow
See other posts from Stack Overflow
or by John
Published on 2011-08-11T15:44:08Z
Indexed on
2012/11/03
23:01 UTC
Read the original article
Hit count: 1217
jsf
|primefaces
I have a command button with an action that returns a new URL to redirect to. When this command button is not inside the p:dialog all works as I would expect, but when I put the command button in the dialog then the dialog just closes and leaves me on the same page.
<h:form id="reviewForm">
<h:messages id="saveMsg" showDetail="true" globalOnly="true"/>
<p:panel style="text-align: center">
<p:commandButton type="button" value="Submit" onclick="showOptions(); areYouSureVar.show();" />
</p:panel>
<p:dialog id="areYouSure" widgetVar="areYouSureVar" resizable="false" width="400" modal="true" header="Are you sure you want to continue?">
<p:panel style="text-align: center">
<p:commandButton id="submit" ajax="false" value="Submit" action="#{mybean.myaction}" oncomplete="areYouSureVar.hide();"/>
<p:commandButton type="button" value="Cancel" onclick="areYouSureVar.hide();"/>
</p:panel>
</p:dialog>
</h:form>
mybean.action returns a string that points to another page, but that page never loads, the dialog goes away and that is all.
© Stack Overflow or respective owner