This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes drop down list validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "drop down list validation" Watch "drop down list validation" New topic

drop down list validation

K Amin

Joined: Oct 11, 2007
Posts: 8
Can any body give me a little example, how to validate for picking up a specific value from a dropdown list, the dropdown list is generated with some file names from a folder location. I am using client site validation for other form fields.

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You validate a dropdown field the same as you would any other field by defining the validation in the validation.xml file. If you're using the "required" validation, you must include a null value option to indicate that the user hasn't selected anything. Example:

Consultant, Sima Solutions
It is sorta covered in the JavaRanch Style Guide.
subject: drop down list validation