Problems on dialog, how to control screen actions when controlated and non controlated errors happens on server side

UI Components for JSF
Post Reply
lupacexi
Posts: 1
Joined: 20 Aug 2017, 23:30

20 Aug 2017, 23:32

I am having a problem related to a dialog.

A dialog is show and allow to make a operation that persists information on database, when de operation has finished the dialog must be hidded, but if there is an error on server side the dialog should not be closed.

I am unable to mantain the popup if there is an error on server side.

¿Could you tell me somenthing to solve it?

RalfScania
Posts: 81
Joined: 26 Sep 2012, 12:51

22 Aug 2017, 14:32

In your validation method you can set

Code: Select all

 facesContext.validationFailed();
In the onComplete of the commandButton you could do this

Code: Select all

oncomplete="if (!args.validationFailed) PF('dialog').hide()"
Primefaces 8.0.4, MyFaces 2.2.8, Tomcat 9.0.8

chrishj
Posts: 229
Joined: 11 Jul 2011, 21:58
Location: England, Lancashire
Contact:

23 Aug 2017, 15:23

An alternative approach would be to use RequestContext in the server method.

This execute the following if all is good with the business logic.
Please see the manual for more details.

Code: Select all

 RequestContext.getCurrentInstance().execute("PF('dialog').hide()");
PrimeReact: 9.6.0
NextJs: 13.4.12
Theme Apollo v9.0
Database pg 8.8.0
react-hook-form: 7.38.0

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 45 guests