google-code-export / validity

Automatically exported from code.google.com/p/validity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sumMin behaves like sumMax

GoogleCodeExporter opened this issue · comments

What steps will reproduce the problem?
1. In an HTML form with id "myform", create a set of inputs with a class of 
.sum.
2. Validate the form using $('#myform .sum').sumMin(1,'At least one item must 
be ordered.'); 
3. Validate the form using $('#myform .sum').sumMax(1,'At least one item must 
be ordered.'); 

What is the expected output? What do you see instead?
* If the inputs sum to 0, I expect to see the error message. If the inputs sum 
to 1 or greater, I expect to see no error message. Instead, the opposite is 
happening.
* In other words, sumMin is acting like sumMax. If I use sumMax, I get the same 
results (an error if the inputs sum to greater than 1)

What version of the product are you using? On what operating system?
jQuery.validity v1.1.1 on Win XP


Please provide any additional information below.
The problem appears to be this line:
 if ($reduction.length && min < numericSum($reduction)) {

When I changed it to 
 if ($reduction.length && min > numericSum($reduction)) {

sumMin worked as expected.

Original issue reported on code.google.com by Kathry...@gmail.com on 12 Feb 2011 at 3:44