0

I am looking for a way to properly handle pop-up dialog close events.

I have OK and Cancel buttons. When OK is selected, actionListener and action are executed. Depending on the result of action, I would like to either:

  1. Close the dialog.
  2. Stay in the dialog and display error or warning message.

Currently I can only do the 1st case with this code:

<p:commandButton 
    id="btnOkId" 
    value="OK" 
    ajax="true" 
    type="submit" 
    actionListener="#{WatchfolderEditBean.save}" 
    action="#WatchfolderMgmtBean.refreshList}" 
    oncomplete="dlgEditWF.hide();" 
    update=":wfMgtForm:wfTable :editWFForm:messagesId"/>

What is the proper way of doing it to be able to stay in the dialog in case action reports some kind of error?

Danijel
  • 8,198
  • 18
  • 69
  • 133
  • 3
    possible duplicate of [Keep open when validation has failed](http://stackoverflow.com/questions/14328115/keep-pdialog-open-when-validation-has-failed) and [Keep p:dialog up when a validation error occurs after submit](http://stackoverflow.com/questions/9195756/keep-pdialog-up-when-a-validation-error-occurs-after-submit) – BalusC May 31 '13 at 14:28
  • yes, please close as duplicate. – Danijel Jun 10 '13 at 09:01

0 Answers0