Hi Morten, We currently have four number types.
Number. This is any real number, with an option single sign (-), a single decimal point and no thousand separators. Scientific notation is not allowed (but could be if there is a real need for it). Integer: Any whole number, including zero. Positive integers: Any whole number greater than zero. Negative integers: Any whole number less than zero. We had problems with some of the Javascript validations, so had to implement more robust ones (see rev 3921 for details). Things like "00" were valid, but should not be allowed. As to whether users know what integers are, I am not sure. The current syntax we have is a bit technical, but adding more number types is likely to confuse things further It is detailed in the user manual, Data element chapter. I am not sure they necessarily know what a natural number is either but I am not opposed to the change of name if it is more clear.. Regardless, there are no negative natural numbers. :) As for the support for scientific notation, I am not necessarily opposed to it, but think we need to stick to the more strict regex validation. Something like ^-?(0|[1-9]\d*)(\.\d+)?(?:[eE][-+]?[0-9]+)?$ would allow scientifically noted numbers, with an optional negative sign, optional decimal, and optional trailing scientific notation. No leading or trailing spaces allowed. Have a look in dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js for details of the different regex checks we developed to support the current four number types. Hope this helps. Jason On Mon, Sep 19, 2011 at 8:48 AM, Hieu Dang Duy <[email protected]> wrote: > > > On Mon, Sep 19, 2011 at 1:42 PM, Morten Olav Hansen <[email protected]> > wrote: >> >> Hi >> >> > I agree with these validation on field but why don't you apply the "Math >> > methods" - which are in commons - into them. The "Math methods" are >> > working >> > on regex that I think it is very very robust in validating. >> >> Ok, sounds good. What are they named? I never found any validations >> for positive/negative numbers.. >> > > Yes, they are isRealNumber() which is including in positive/negative > numbers, isNegativeInt(), and isPositiveInt(). > >> >> > Btw, the name of method "positive/negative_natural_number" is quite >> > sensitive to me. >> >> The naming here is a bit off. I need suggestions here, even whole >> numbers is not defined always mean the set of all integers. >> >> -- >> Morten > > About this you could also ask Jason for more suggestion. > > -- > "Expert By Chance" > > _______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : [email protected] Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp

