Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22

Thread: input mask plugin

  1. #11

    Default

    Just used your code. Seems to work very well. Thanks. Wonder if there is an updated version. Is there? The only thing so far that I think I would change is to have the input cursor placed at the first type in char. For example, if the mask is "(999) 999-9999", I would have the input cursor positioned at the first "9", so the user can immediately start typing. This would be great functionality to have added to GXT. Thanks

  2. #12
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744

    Default

    I have not changed over the code that did not use it more. More if you have any idea or any contribution is welcome ..

  3. #13
    Ext User
    Join Date
    Sep 2008
    Location
    Germany
    Posts
    961

    Default

    nice Widget :-)

    i have this questions:

    1) is this also working in GXT 2.x?
    2) is it not better to create it as a component plugin or not (so it can work with other types than String)
    This forum needs your help: you got hints from the community and now you have fixed your code? dont just reply with "now its fixed" or "i found the error"! please take the time to post also an detailed answer with the working code.

    GreaseMonkey Script for a GXT-only Forum: it hides ExtJs here: New Posts Search Results Advanced Search form Category overview http://www.extjs.com/forum/showthrea...041#post410041

  4. #14
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744

    Default

    I dont know too.. because I dont use more.. you can test?

  5. #15

    Default

    Hi, Just wondering why you don't use the mask code anymore. Did you find what seems a better alternative? Thanks

  6. #16

    Question Repaint mask

    Hi,

    How I can refresh the mask of the TextFieldMask Object ? I tried using layout method in the contentpane, but not working...

  7. #17

    Default

    Quote Originally Posted by titobundy View Post
    Hi,

    How I can refresh the mask of the TextFieldMask Object ? I tried using layout method in the contentpane, but not working...
    I solved this problem implementing setMask method

    public void setMask(String mask) {
    this.mask = mask;

    maskField();
    }

  8. #18

    Default checkVal() returns wrong position

    Hello,

    the checkVal() Method returns the wrong position. I added

    a++;

    before "return a;" to correct the position.

    GXT Version: 2.2.0

    Best Regards,
    Jonas

  9. #19
    Sencha User
    Join Date
    May 2011
    Location
    Illinois
    Posts
    32

    Default

    Quote Originally Posted by jonas.esser View Post
    Hello,

    the checkVal() Method returns the wrong position. I added

    a++;

    before "return a;" to correct the position.

    GXT Version: 2.2.0

    Best Regards,
    Jonas
    For anyone stumbling across this - This solution will only work when the first editable character is in the second position. I have implemented a small fix that will handle the cases where the first editable character is in any position. Basically, the original code is always skipping over the a = i; because of the use of the break statements. I am using GXT Version 2.3.0

    Code:
       private int checkVal(boolean allow) {
    
            String test = "";
    
    
            if (getValue() != null) {
                test = getValue();
            }
    
    
            int lastMatch = -1;
    
    
            int a = 0;
    
    
            for (int i = 0, pos = 0; i < len; i++) {
                if (tests[i] != null) {
                    buffer[i] = settings.getPlaceHolder();
    
    
                    while (pos++ < test.length()) {
                        String c = String.valueOf(test.charAt(pos - 1));
    
    
                        if (c.matches(tests[i])) {
    
    
                            buffer[i] = String.valueOf(c);
                            lastMatch = i;
                            a = i;
                            break;
                        }
                    }
                    if (pos > test.length()) {
                        a = i;
                        break;
                    }
                } else if (i != partialPosition) {
                    try {
                        char d = test.charAt(pos);
    
    
                        if (buffer[i].equals(String.valueOf(d))) {
                            pos++;
                            lastMatch = i;
                        }
                    } catch (Exception e) {
                        continue;
                    }
                }
            }
    
    
            if (!allow && lastMatch + 1 < partialPosition) {
                setValue("");
                clearBuffer(0, len);
    
    
            } else if (allow || lastMatch + 1 >= partialPosition) {
                writeBuffer();
    
    
                if (!allow) {
    
    
                    if (getValue() != null) {
                        setValue(getValue().substring(0, lastMatch + 1));
                    }
                }
            }
            
            return a;
        }

  10. #20

    Default Urgent: Does this plugin work in Mozilla 3.0.9?

    This is a wonderful plugin! Noticed that it is compatible with Chrome and IE, however doesn't seem to work for mozilla (version 3.0.19). Will be greatful if you could help me out by providing the necessary code.
    Awaiting your response....

    Thanking you in advance,
    Pavitra

Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

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