Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Strange Problem with type "integer"

    Hi,

    I am using a dynamic form in which one of the field is of type "integer" using Smart Client 'integerRange' validators.
    The problem is that while entering the data in the field, it is not accepting if enter the 008 or 009 values. The error comes as: "Must be a whole number”.
    But the error is not coming when we enter 001,002 to 007.

    The code of the field is given as:

    Code:
    {
    	                          title: "Transit Days",			                         
                                          name:"frmTransitDays",
    			type:"integer",
    			length:3,
    			stopOnErrors:true,
    			validators:[
    			{type:"integerRange", min:0, max:999, errorMessage:"Transit days must be greater than or equal to 0"}
    			]
    },
    Please help me fight this strange issue.

    Thanks,
    Parul

    #2
    I'll hazard a guess that the numbers are treated as octal because of the leading zero and therefore 008 and 009 are not valid octal numbers. If you leave off the leading zeros, it should be fine. This is a feature of parseInt() without specifying a base (like 10).

    Comment


      #3
      Hi Guys
      Looks like David is correct here. We're changing the isInteger validator code for 7.0 to handle this and avoid this confusion in the future.

      Isomorphic Software

      Comment


        #4
        Thanks a lot David and Isomorphic for such a quick response :)

        Comment

        Working...
        X