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 Struts Validator - 3 textboxes to one error 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 "Struts Validator - 3 textboxes to one error" Watch "Struts Validator - 3 textboxes to one error" New topic
Author

Struts Validator - 3 textboxes to one error

Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Our application has inputs for a date and the date is required.
The format is 3 textboxes with slashes between the boxes:
<textboxMM>/<textboxdd>/<textboxYYYY>
The date is required. Here's the problem: if any combination of textboxes is left blank we need 1 error to display. If all are blank we do not want 3 errors.
We'll also need to verify if the date is valid, but I think that solving the "required" issue is solved will take care of other problems of fields that depend on one another. :roll:
I am currently reading on Interrelated fields [Husted pg 397] but having trouble piecing the logic together for what I need.


A good workman is known by his tools.
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Never mind! I got what I wanted, despite the deprecation AND errata of the code in the book. :roll:
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Struts Validator - 3 textboxes to one error