1. #1
    Sencha User
    Join Date
    Jul 2009
    Location
    Dallas, TX
    Posts
    5
    Vote Rating
    0
    bkgrover is on a distinguished road

      0  

    Default Unanswered: Leading zeros in numberfield (Ext.form.field.Number) in 4.x

    Unanswered: Leading zeros in numberfield (Ext.form.field.Number) in 4.x


    I'm trying to extend the numberfield to have leading zeros and wanted to see if anybody has done this before.
    I would like to have a hour, minute, and seconds fields that allow the user to enter a single number and the form field format the entry with leading zero. (i.e. The user enters 5 and tabs to the next field then the UI would show 05)

    I've search the forum and found some related post but none for the extjs 4.x.

    Here are some previous posts...
    http://www.sencha.com/forum/showthread.php?37139-Ext.ux.NumberFieldLeadingZeroes

    http://www.sencha.com/forum/showthread.php?22233-Prevent-stripping-of-Leading-Zero-s-in-NumberField



  2. #2
    Sencha - Services Team tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,292
    Vote Rating
    6
    Answers
    56
    tobiu will become famous soon enough

      1  

    Default


    both approaches should also work for ext 4. in case you want to migrate my ux to ext 4, you will need to take a look at the new setValue method and adjust changes (should be quite easy).

    using a textfield with the maskRe - config set to
    Code:
    maskRe:/\d/
    is also ok. you can set a listener on the blur event and change the value of the field.
    Best regards
    Tobias Uhlig
    __________


    Sencha Inc
    Tobias Uhlig, Solutions Engineer

    Private Projects:

    S-CIRCLES Social Network Engine
    Commercial Theming for Ext JS 3 & 4

  3. #3
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,078
    Vote Rating
    112
    Answers
    453
    skirtle is a splendid one to behold skirtle is a splendid one to behold skirtle is a splendid one to behold skirtle is a splendid one to behold skirtle is a splendid one to behold skirtle is a splendid one to behold skirtle is a splendid one to behold

      0  

    Default


    Maybe this would help?

    http://www.sencha.com/forum/showthre...828#post644523

    It was intended to be used for currencies but you should be able to tweak the format to whatever you want.