Keep Rich-Faces modal panel open when form validation errors occur
Keeping a model panel open after form validation produced errors is a bit puzzling. I found some good hints in the Rich-Faces Developer Guide
-you need a few lines of JavaScript though;(
The guide refers to a Rich-Faces Wiki article and a forum posting.
I have slightly modified the solution. On top of the page (outside the modal panel) I added a hidden form field that just indicates if validation messages exist.
The method property hasMessages is implemented as follows:
public boolean isHasMessages() {
return FacesContext.getCurrentInstance().getMessages().hasNext();
}
The button uses the oncomplete attribute to test the hasMessages element with a little bit of Javascript.
