Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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 Android Security Essentials Live Lessons this week in the Android 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?
 
Similar Threads
User Id validation problem on JSP page
Disable Url
Dreamcar assignment for Part II
Problem with Struts2 validation
validating user input for number of seats