WjInputMask For IP Address

Posted by: vishalramdas-jagtap on 14 September 2017, 12:00 pm EST

    • Post Options:
    • Link

    Posted 14 September 2017, 12:00 pm EST

    Hi there,

         I came across a situation where i used WjInputMask for IP Address field. But could not implement it with its potential.
    
         Has any one used WjInputMask for similar case if yes then please share an example.
    
         Few of the issued i faced are as below:
    
             >  format -  ( ____ . ____ . ____ . ____ ) ( tried with mask in this format before, now changed to 000.000...)
             >  want to remove the underscore and keep the dot separator.
             >  whenever i click on such field with a value already in it, the input mask gets cleared
             >  I am using the mask input in a flexgrid along with cell template below is the code snippet
    
    <wj-flex-grid-column header="IP Address" binding="IpAddress" format="n0" align="center" min-width="130" width="150">
        <wj-flex-grid-cell-template cell-type="CellEdit">
            <wj-input-mask id="wjMask1" mask="000.000.000.000" value="$value" format="{{$col.format}}" initialized="s.focus()">
            </wj-input-mask>
        </wj-flex-grid-cell-template>
    </wj-flex-grid-column>
         An good example with validation would be really appreciated.
    

    Thanks in Advance.

    Regards,

    Vishal

  • Posted 14 September 2017, 12:00 pm EST

    Hi,

    I am looking into this. I shall get back to you on this tommorrow.

    Thanks,

    Abhishek

  • Posted 14 September 2017, 12:00 pm EST

    Hi,

    If you want to remove the underscore then you can set the promptChar property of Input Mask to an empty string inside the initialized event of the Input Mask.

    I haven’t being able to replicate the issue regarding the input mask getting cleared after clicking on it. Please refer to the code implementation below:

    <div ng-app="app" ng-controller="appCtrl">
        <p>Wijmo <b>FlexGrid</b> cell edit templates
        </p>
        <wj-flex-grid items-source="data" >
           <wj-flex-grid-column 
            format="n0"
            lign="center" min-width="130" width="150"
               header="IpAddress" 
               binding="IpAddress">
                <wj-flex-grid-cell-template cell-type="CellEdit">
                   <wj-input-mask  mask="000.000.000.000" value="$value"  format="{{$col.format}}" initialized="init(s)">
            </wj-input-mask>
                </wj-flex-grid-cell-template>
               </wj-flex-grid-column>
           <wj-flex-grid-column 
               header="Date" 
               binding="date"
               width="*" 
               format="MM/dd/yyyy hh:mm:ss">
                <wj-flex-grid-cell-template cell-type="CellEdit" >
                    <wj-input-date 
                        value="$value" 
                        format="{{$col.format}}"
                        style="width:100%;height:100%;box-sizing:border-box">
                        </wj-input-date>
                </wj-flex-grid-cell-template>
           </wj-flex-grid-column>
           <wj-flex-grid-column 
               header="Downloads" 
               binding="downloads" 
               format="n0">
                <wj-flex-grid-cell-template cell-type="CellEdit" >
                    <wj-input-number 
                        value="$value" 
                        step="1" 
                        format="{{$col.format}}"
                        initialized="s.focus()">
                     </wj-input-number>
                </wj-flex-grid-cell-template>
           </wj-flex-grid-column>
        </wj-flex-grid>
    </div>
    
    
    // define app, include Wijmo 5 directives
      var app = angular.module('app', ['wj']);
    
      // controller
      app.controller('appCtrl', function ($scope) {
    
          // create some random data
          var countries = 'US,Germany,UK,Japan,Italy,Greece'.split(','),
              data = [];
          for (var i = 0; i < countries.length; i++) {
              data.push({
                  country: countries[i],
                  downloads: Math.round(Math.random() * 20000),
                  sales: Math.random() * 10000,
                  expenses: Math.random() * 5000,
                  date: new Date(2015, i % 12, i % 27 + 1),
                  IpAddress:"123.123.123.123"
              });
          }
    
    $scope.init=function(s)
    {
     s.promptChar = " ";
    }
    
          // expose data as a CollectionView to get events
          $scope.data = new wijmo.collections.CollectionView(data);
          $scope.countries = countries;
      });

    You can find a working fiddle implementation here. If you are still facing the issue then please modify the fiddle so that it reproduces the issue and send it back to us, we will investigate this further.

  • Posted 14 September 2017, 12:00 pm EST

    Hi,

    Thanks for your reply.

    i faced issue if i entered IP address “11 .127.12 .281” through input mask, it display “11.127.122.81” after selecting the next row. and the character position also shift while entering the character. the character position should be fixed, if we type or remove the other digit. some time it also display “11.127.1228.81” how to avoid it.

    could you please help it out, Please find attached file for more better understanding.

    Regards,

    Tarannum Banu

  • Posted 14 September 2017, 12:00 pm EST

    Hello Tarannum ,

    We are looking into this and will reply on monday.

    Thanks,

    Manish Kumar Gupta

  • Posted 14 September 2017, 12:00 pm EST

    Hello Tarannum,

    Please use different mask 999.999.999.999 instead of 000.000.000.000. This will allow you to enter space.

    For your reference, please see the attached sample that implements the same and created using latest build 5.20171.282 which can be downloaded from here.

    Hope it helps !

    Thanks,

    Manish Kumar Gupta

    2017/04/FlexGrid_IpAddress.zip

  • Posted 23 November 2018, 7:53 am EST

    Hello Manish,

    Thanks for your reply.

    I used the above eg. it was working fine if display IP address value (123.123.123.123) but if the default load value is (123.12.12.123) then again while perform edit operation it display (123.121.121.23).

    e.g.

    instead of IP Address (123.123.123.123) on load please give (123.12.12.123)

    Could you please check above scenario.

    Thanks for your support.

    Regards,

    Tarannum banu

  • Posted 27 November 2018, 8:08 am EST

    Please reply it for below issue.

    I used the above eg. it was working fine if display IP address value (123.123.123.123) but if the first load value is (123.12.12.123) then again while perform edit operation it change the value and display (123.121.121.23).

    e.g.

    instead of IP Address (123.123.123.123) default please give (123.12.12.123)

    Could you please check above scenario.

    Thanks for your support.

    Regards,

    Tarannum banu

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels