This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Validator Problem?

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using struts 1.1b3 release. When I am doing validation, I set up 2 fields in my validation.xml file. I have both fields as required. Field 1 has to also validate a minlength and Field 2 has to validate against a range. The following will illustrate the issue I'm having.
Situation #1
Field 1: (leave blank)
Field 2: (leave blank)
Error Messages:
Field 1 is required
Field 2 is required
Situation #2
Field 1: hello (this should fail validation)
Field 2: (leave blank)
Error Messages:
Field 2 is required
In situation #2, I would also expect an error message from Field 1 stating that it does not meet the minlength rule. Instead, it looks like the validator is making the user enter in all of the required fields before going forward with any validation.
I was wondering if anyone else had noticed this behavior??
Thanks
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm no validator guru on struts other than playing with it a bit. However, if memory serves me right, if you look at the javascript generated for the button, you'll see that it sequentially calls each generated javascript function. If the called function says it failed validation, then it stops.
Long story short. It will only emit errors for one "kind of" validation and those must be fixed before it will even attempt to validate other aspects of the properties on the page.
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is only true for the JavaScript validation. Server side validation will report both errors.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic