Win a copy of Penetration Testing Basics this week in the Security forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FacesMessages and valueChangeListener with immediate="true"

James Ellis
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSF page that posts to a request scoped bean. Within this JSF page there is a dropdown with a valueChangeListener and immediate="true" to submit the form (without validation) and change the values of a second dropdown below the first one.

My problem arises during the following scenario:

1) User submits form to request scoped bean with some fields not filled out. FacesMessages are added and the page is redisplayed showing the errors to the user that they forgot to fill out some fields.

2) Along with filling out the required fields they had missed, user decides to change dropdown box value which fires the valueChangeListener. The valueChangeListener redisplays the page except this time the error messages that were at the top of the page are gone. This is not a good user experience.

Any suggestions on how to deal with validation messages (FacesMessages) when you've also got a valueChangeListener and immediate="true"?

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic