Menu

Is it possible to turn OFF AutoComplete in InputMask?

Tom Moore
2015-12-17
2015-12-20
  • Tom Moore

    Tom Moore - 2015-12-17

    I have a zip code field and I want to allow 5 digit OR 10 digit ie ##### or #####-####. If the user only puts in a 5 digit zip (ie 74074) it inserts a trailing - on the end (ie 74074-). I would like to NOT have the trailing - character, but still have it insert the - character if they type in a 6th character.

    Thanks in advance for any suggestions!
    Tom Moore

     
    • Tom Moore

      Tom Moore - 2015-12-20

      Ok, so I don't know if it is "THE" answer, but I found a way to do what I asked for. In my code, I inserted this after the mask:

      var ZipMask = new InputMask("#####-####", "Zip");
      ZipMask.blurFunction = function () {
      if (this.value.substring(this.value.length -1, this.value.length) == '-') {
      this.value = this.value.substring(0, this.value.length - 1);
      }
      };

       

      Last edit: Tom Moore 2015-12-20

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.