Menu

Avoid Mask on TAB

Nobody
2006-06-12
2013-04-22
  • Nobody

    Nobody - 2006-06-12

    I'm having a problem on IE related possibly to the inputmask.

    The problem I think can be solved by telling the InputMask to not update the value (don't throw onChange) when pressing the TAB key, this shouldn't be necessary since the mask is applied every time the user presses a key.

    CAn you please tell me how to do this?

     
    • Luis Fernando Planella Gonzalez

      This is done because the field value may be changed by pasting text with the mouse...
      Anyway, if you want to disable, change the JST_MASK_VALIDATE_ON_BLUR value to false.

       
      • Nobody

        Nobody - 2006-06-14

        There is a problem. Even though I put the JST_MASK_VALIDATE_ON_BLUR value to false, the keyup event is thrown on the control where the cursor ends up positioned. So when the next control has a mask, it executes the event onKeyUp there.

        This is on IE. I already fixed it by putting this condition on the onKeyUp function, like this:

            //The KeyUp event will apply the mask
                function onKeyUp (event) {
                if (window.event) {
                    event = window.event;
                }
                //alert(event.type + this.ignore);
                //Check if it's not an ignored key
                var keyCode = typedCode(event);
                if (this.ignore != true && keyCode != 9) {
                    applyMask(this.mask, false);
                }
                //Check for extra function on keydown
                if (this.mask.keyUpFunction != null) {
                    var ret = this.mask.keyUpFunction(event, this.mask);
                    if (ret == false) {
                        return false;
                    }
                }

                return true;
            }

        I don't know if it's going to break anything else, but I couldn't come up with a better solution in  so little time I have.

         
    • Luis Fernando Planella Gonzalez

      Really, the TAB key applies the mask...
      The best solution is to append 9 to the array JST_IGNORED_KEY_CODES.
      Perhaps I'll implement it on the next version.
      Please, let me know if it works...

       
      • Nobody

        Nobody - 2006-06-14

        Ah! There's a new version with that array. I'm using   2.0.4. I will try the new version when I'm sure it works OK with everything.

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.