Results 1 to 5 of 5

Thread: Numberfield discards leading zero

  1. #1

    Default Numberfield discards leading zero

    Hi,

    I have an Numberfield in my form and this needs to send the number just like the user types it in. The number is an serial number of an ID Card, in this case I need the leeding zeros. But the Numberfield discards all zeros in front an begins with the first number unequal zero.
    How can I change this? If there is no method I need to take an Textfield, because this sents the whole input.

    Thanks and greatings
    Nawabu

  2. #2
    Sencha Premium User mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    3,153

    Default

    You could use a textfield and assign a custom vType to it to force only integers to be allowed.

  3. #3
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,751

    Default

    hi nawabu,

    i am still using my ux http://www.extjs.com/forum/showthread.php?t=37139 for this problem. should work fine with ext-3.0.3 too.

    kind regards,
    tobiu

  4. #4
    Sencha User mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236

    Default

    just a note:

    javascript itself discards leading zeroes in integer values.

  5. #5
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,751

    Default

    hi mystix,

    true, with a leading zero, it is no longer an integer but a string.

    the modified version of the field makes sense for phone-numbers. example:

    0221-2457
    0221 - 2457
    0221/2457
    0221 / 2457

    will force the user to enter 02212457, so that phone-numbers are formatted in an unique way and can get rendered like (+49)221-2457.

    the other way would be to use a textfield with a quite complex regex-validation.


    kind regards,
    tobiu

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •