my dog learned polymorphism*
The moose likes Struts and the fly likes validate only if field is visible? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "validate only if field is visible?" Watch "validate only if field is visible?" New topic
Author

validate only if field is visible?

shah rah
Ranch Hand

Joined: Jan 04, 2007
Posts: 124
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

Joined: Feb 15, 2005
Posts: 4864
You should be able to do this with a "validWhen" validation. See the heading "Conditionally Required Fields" in this link for more information.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: validate only if field is visible?