Issue Details (XML | Word | Printable)

Key: STR-2882
Type: Improvement Improvement
Status: Closed Closed
Resolution: Duplicate
Priority: Major Major
Assignee: Paul Benedict
Reporter: HC
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Struts 1

Validator: Using validwhen with float validation

Created: 02/Jun/06 10:06 PM   Updated: 26/Aug/07 11:47 PM
Return to search
Component/s: Unknown
Affects Version/s: 1.2 Family
Fix Version/s: 1.4.0

Environment: I am using Windows XP, JDK 1.4, Struts 1.2.8
Issue Links:
Duplicate
 


 Description  « Hide
1. This has to do with the "validwhen" validations. Especially when used with "float" as defined in validation.xml.
Scenario: I have a field which is validated as follows:
- It is a float.
- It has to be > 0.

When I input 0, the validation works correctly i.e. I get an error. But when I input 0.0, the validation does not raise an error.

My thought is that there is a problem with the way the <var> element for the "validwhen" is parsed.

2. Another place where I see somewhat similar behavior is as follows.
Scenario: I have a field which is validated as follow:
- It is a float
- It has to <= 12

When I input something like 4, it goes through fine i.e. I don't get an error. But when I input something like 4.5 or 4.7 or 5.3 (basically numbers with decimal points), I get an error.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Henri Yandell added a comment - 06/Jun/06 03:14 AM
Some info that sounds useful in helping with this issue are the relevant parts of your configuration, and the version of commons-validator that you're using. It might point out something obvious.

Niall Pemberton added a comment - 09/Nov/06 02:29 AM
validwhen only supports integer numeric values - see the Validator User Guide, section "Designing Complex Validations with validwhen":

http://struts.apache.org/1.x/faqs/validator.html

Niall Pemberton added a comment - 09/Nov/06 02:30 AM
Closing as a duplicate of STR-2321

HC added a comment - 09/Nov/06 03:20 AM

   [[ Old comment, sent by email on Wed, 8 Nov 2006 20:34:00 -0600 ]]

Cool! Thanks.



--
http://hchaudh1.stumbleupon.com/