← Back to team overview

dhis2-devs team mailing list archive

Re: [Bug 790172] Re: integers-values-do-not-allow-negative-numbers

 

Hi Hieu,

The question is not whether the input value is not a number.  The question
is whether the input is an integer.
An integer is a number, but not all numbers are integers. The current regex
in commons.js is simply incorrect.

Regards,
Jason


On Tue, May 31, 2011 at 5:22 AM, Hieu Duy Dang
<hieu.hispvietnam@xxxxxxxxx>wrote:

> Hi Jason,
>
> I think we could use this supporting method which is already from
> javascript
> isNaN(value). This one will return true or false whether the input value is
> a number or not.
>
> On Mon, May 30, 2011 at 8:58 PM, jason.p.pickering <
> 790172@xxxxxxxxxxxxxxxxxx> wrote:
>
> > === modified file
> > 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dh
> > is-web-commons/javascripts/commons.js'
> > ---
> >
> dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/
> > javascripts/commons.js  2011-05-28 14:40:32 +0000
> > +++
> >
> dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/
> > javascripts/commons.js  2011-05-30 13:52:04 +0000
> > @@ -1439,7 +1439,7 @@
> >
> >  function isInt(value)
> >  {
> > -       var regex = /^\d+$/;
> > +       var regex = /[-]?\b\d+\b/;
> >        return regex.test( value );
> >  }
> >
> > --
> > You received this bug notification because you are a member of DHIS 2
> > India Developers, which is subscribed to DHIS.
> > https://bugs.launchpad.net/bugs/790172
> >
> > Title:
> >  integers-values-do-not-allow-negative-numbers
> >
> > Status in DHIS 2 - District Health Information Software:
> >  New
> >
> > Bug description:
> >  Last time I checked, integers included both positive and negative
> >  values with no decimal places. In our case, we need to enter a stock
> >  loss (negative) or adjustments (positive). When I enter a negative
> >   number (-1) after having set the type of the data element to integer I
> >  receive the message that the number must be an integer, which it is.
> >  :)
> >
> >  On Rev 3643.
> >
>
>
> --
> Good heath !
>
> --
> You received this bug notification because you are a member of DHIS 2
> India Developers, which is subscribed to DHIS.
> https://bugs.launchpad.net/bugs/790172
>
> Title:
>  integers-values-do-not-allow-negative-numbers
>
> Status in DHIS 2 - District Health Information Software:
>   Confirmed
>
> Bug description:
>  Last time I checked, integers included both positive and negative
>  values with no decimal places. In our case, we need to enter a stock
>  loss (negative) or adjustments (positive). When I enter a negative
>  number (-1) after having set the type of the data element to integer I
>  receive the message that the number must be an integer, which it is.
>  :)
>
>  On Rev 3643.
>

-- 
You received this bug notification because you are a member of DHIS 2
developers, which is subscribed to DHIS.
https://bugs.launchpad.net/bugs/790172

Title:
  integers-values-do-not-allow-negative-numbers

Status in DHIS 2 - District Health Information Software:
  Confirmed

Bug description:
  Last time I checked, integers included both positive and negative
  values with no decimal places. In our case, we need to enter a stock
  loss (negative) or adjustments (positive). When I enter a negative
  number (-1) after having set the type of the data element to integer I
  receive the message that the number must be an integer, which it is.
  :)

  On Rev 3643.


References