• Post Reply Bookmark Topic Watch Topic
  • New Topic

validation: two forms on same page

 
J Haley
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I�ve got a problem with validation when I have two forms on the same page. In each form I display my error message by using h:messages. The problem is when I get an error on one form I end up displaying the message on both forms. I thought about using h:message and the �for� attribute, but this does not work. Reason being I�ve got backend validation that is not field specific it is form specific. Is there a way to tie h:messages to the form it�s contained in?
 
Rick Beaver
Ranch Hand
Posts: 464
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

I don't believe you can do this with the h:messages. h:messages pulls all messages out of the current FacesContext instance, which will display any messages in there whether from form validation or otherwise.
 
Ravi Katam
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I saw your problem and thought you could help me with my problem. Some of my jsf forms have other jsf forms included. I am trying to validate fields on both forms but validation only effects the fields on the main form and not on the included form. Could you please give me any advise?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!