Menu

inputMask Autocomplete by '0'

Aziz Aziz
2009-09-04
2013-04-22
  • Aziz Aziz

    Aziz Aziz - 2009-09-04

    Hi,

    Is it possible to override the autocomplete field by '0'  when we use an inputMask('####').
    For example : i define a mask for only numbers with decalring an inputMask('#########').
    after entered a number, for example 9, the framework complete the field by '0' like '000000009'

    Thanks

    Regards

    Philippe

     
    • Luis Fernando Planella Gonzalez

      That is supported out of the box, but after the field looses focus.
      For example: if the mask is ##### and you type 1, as you leave the field it will be changed to 00001.

       
    • Aziz Aziz

      Aziz Aziz - 2009-09-04

      Ok,
      In fact i would like to know if it's possible to keep the entered value after the loose of the focus : in your example, i would like to keep the value '1' and not complete by '0'.   
      Thanks

       
      • Luis Fernando Planella Gonzalez

        Then what you want is not an InputMask, but a NumberMask.
        Try this:
        var numberParser = new NumberParser(0);
        numberParser.useGrouping = false;
        new NumberMask(numberParser, input, 5) //5 is the max integer digits

         
    • Aziz Aziz

      Aziz Aziz - 2009-09-04

      Thank You Luis,
      However i have a bug when for example i entered '06050', the first '0' is automatically  deleted , the result given is '6050' !

       
      • Luis Fernando Planella Gonzalez

        Ok, I don't get what you want. You want a mask that removes the leading 0's but you've complained that the NumberMask removed it...
        Sorry, I don't think what you want is possible. By the way, I think you haven't figured out exactly what you want.

         
    • Aziz Aziz

      Aziz Aziz - 2009-09-06

      Ok, i take again your example :
      var numberParser = new NumberParser(0);
      numberParser.useGrouping = false;
      new NumberMask(numberParser, input, 5)
      if i entered the number '05678', after lost focus the number will be '5678 ' while i entered 05678 (i lost '0' !); if i use an inputMask('####'), and i entered the number 34, after lost focus the number entered tunr into '0034' ; i can understand for the last case there is an autocomplete by '0' for an inputMask('###') but in the first case (when i use an NumberMask) i don't see why the '0' disappear after lost focus !
      Anyway your framework is very interesting beyond the mask, i have recommended it to other developers...congratulations.

       

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.