This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

validate only if field is visible?

 
shah rah
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a radio button Yes/No. If user clicks 'No' I make the hidden text box visible. this textbox validation should trigger if it is empty. How to do this? if user pressed YES then the validation should not fire.

can this be done using struts validation.xml or I should stick to client side javascript?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should be able to do this with a "validWhen" validation. See the heading "Conditionally Required Fields" in this link for more information.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic