← Back to team overview

dhis2-devs team mailing list archive

Re: [Branch ~dhis2-devs-core/dhis2/trunk] Rev 3800: Fix bug: Integers-values-do-not-allow-negative-numbers.

 

I guess this is one way of doing without a regex.

I think this regex is a bit better than the one I provided earlier, but I
see you have done it a different way anyway.

^(0|-?[1-9]\d*)$



On Tue, May 31, 2011 at 7:16 AM, <noreply@xxxxxxxxxxxxx> wrote:

> ------------------------------------------------------------
> revno: 3800
> committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
> branch nick: dhis2
> timestamp: Tue 2011-05-31 12:12:16 +0700
> message:
>  Fix bug: Integers-values-do-not-allow-negative-numbers.
> modified:
>
>  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
>
>
> --
> lp:dhis2
> https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
>
> Your team DHIS 2 developers is subscribed to branch lp:dhis2.
> To unsubscribe from this branch go to
> https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-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-31 05:12:16 +0000
> @@ -1439,8 +1439,8 @@
>
>  function isInt(value)
>  {
> -       var regex = /^\d+$/;
> -       return regex.test( value );
> +       //var regex = /^\d+$/;
> +       return ( parseInt(value) == value );
>  }
>
>  function isPositiveNumber( value )
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>

References