• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

double validation not catching text

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to use the struts validator (using struts 1.2.7) to make sure the user enters a double value in a given range. When I enter a number outside the given range, I get the error as expected. But when I enter text, such as "hgl," I don't get any errors. "hgl" cannot be converted to a Double, so why is the validator not catching it? I am at a loss. If anyone can help, I'd be grateful.

Here is my validation:
<field property="financialFile.useTaxRate"
depends="double,doubleRange">
<arg0 key="Financial File: Use Tax Rate"
resource="false" />
<arg1 name="doubleRange" key="${var:min}" resource="false"/>
<arg2 name="doubleRange" key="${var:max}" resource="false"/>
<var>
<var-name>min</var-name>
<var-value>000.00</var-value>
</var>
<var>
<var-name>max</var-name>
<var-value>999.99</var-value>
</var>
</field>
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does your form look like? If you do not have your properties there defined as Strings then the validation framework cannot detect invalid entries.

- Brent
 
K Dombroski
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have useTaxRate defined as a double in my form. Will that not work?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic