0

Am Upgrading application from PrimeFaces 6.1 to PrimeFaces 6.2. I have <p:dialog appendTo="@(body)" id="dialog" widgetVar="widgetVar" modal="true"> with <p:message id="validation"> element inside it.

Am opening dialog using PF('widgetVar').show(). When I click p:commandButton inside dialog, doing some validation and showing message using below code,

FacesContext.getCurrentInstance().addMessage("validation", new 
FacesMessage(FacesMessage.SEVERITY_ERROR, "validation error", null))

With in the same method am reopening dialog and update it with below code,

RequestContext context = RequestContext.getCurrentInstance();
context.update("dialog");
context.execute("PF('widgetVar').show();")

In PrimeFaces 6.1 its working fine and validation message getting displayed. But in PrimeFaces 6.2 validation Message not displaying in dialog. I know RequestContext is deprecated in PF 6.2. Am also tried with below code,

PrimeFaces primefaces = PrimeFaces.current();
primefaces.ajax().update("dialog");
primefaces.executeScript("PF('widgetVar').show();");

Facing same issue. I saw that message displaying and immediately its getting cleared. But, when I remove the ajax update primefaces.ajax().update("dialog"); It's working fine.

What is the reason for this issue?

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
user3410249
  • 161
  • 4
  • 14
  • 1
    I can only add one comment to this question... [mcve]... – Kukeltje Nov 19 '19 at 13:47
  • "Am upgrading application from PrimeFaces 6.1 to PrimeFaces 6.2". Try upgrading to 7.0. Please note that 8.0 is around the corner, so testing with a 8.0-SNAPSHOT is also something to consider. – Jasper de Vries Nov 20 '19 at 15:24
  • With [this](https://stackoverflow.com/questions/9195756/keep-pdialog-open-when-a-validation-error-occurs-after-submit) you can avoid to reopen your dialog – WoAiNii Feb 11 '20 at 19:31

0 Answers0