• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

validation: two forms on same page

 
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?
 
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.
 
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?
 
when your children are suffering from your punishment, tell your them it will help them write good poetry when they are older. Like this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic