Telerik Forums
Kendo UI for jQuery Forum
1 answer
73 views

Is it possible to use the MaskedTextBox for entering a software version string? major.minor.revision.build? 

 

Viktor Tachev
Telerik team
 answered on 11 Apr 2018
3 answers
1.0K+ views

Hello

I recently updated to KendoUI 2018.1.221 and have to do some adjustments now. It looks like that the kendoMaskedTextBox is acting different now and I can't find a (proper) solution for this problem to fix it: There is always a rounded border as soon as I put a kendoMaskedTextBox on a input. I have prepared a simple example or you can use this code to show you the effect:

<!DOCTYPE html>
<html lang="en">
 
    <head>
        <meta charset="UTF-8">
 
        <!-- Telerik Framework -->
        <link href="http://kendo.cdn.telerik.com/2018.1.221/styles/kendo.common.min.css" rel="stylesheet" />
        <link href="http://kendo.cdn.telerik.com/2018.1.221/styles/kendo.default.min.css" rel="stylesheet" />
 
        <script src="http://kendo.cdn.telerik.com/2018.1.221/js/jquery.min.js"></script>
        <script src="http://kendo.cdn.telerik.com/2018.1.221/js/kendo.all.min.js"></script>
 
        <script>
            $(document).ready(function() {
                $("#starttime").kendoMaskedTextBox({
                    mask: 'h0:t0:t0',
                    rules: { 'h': /[0-2]/, 't': /[0-5]/ }
                });
            });
 
        </script>
 
    </head>
 
    <body style="background-color: #f1f1f1">
        <div>
            <input id="starttime" style="border:1px solid blue;">
        </div>
    </body>
</html>

 

As you can see there are two borders:
The inner one seems to be set by the widget.
The outer one is set by me (style). I don't know why that widget puts a border by default (that I don't want). The widget should only mask the input and not style it, imho.

I've checked all your samples on the API page of MaskedTextBox and they all have rounded corners. 

How do I get rid of that rounded border inside the input?

Regards

Orlin
Telerik team
 answered on 03 Apr 2018
4 answers
417 views

Hello

I'm displaying a time in an input field with maskedTextbox on it. I allow the user to specify his preferred time format:

hh:mm:ss or hh.mm.ss. or hh/mm/ss       (hours:minutes:seconds)

It works fine working with the separator : and / but not with . (dot). Here is a working example showing you that the dot is overwritten by a coma:

<!DOCTYPE html>
<html>
<head>
    <title></title>
 
    <!-- This works fine
    -->
</head>
 
<script type="text/javascript">
    $(document).ready(function() {
        kendo.culture("de-DE"); // Same problem with 'de-AT'
        // kendo.culture("de-CH"); // This works fine
 
        $(".maskTimer").kendoMaskedTextBox({
            mask: "h0.t0.t0",
            rules: {h: /[0-2]/, t: /[0-5]/}
        });
    });
</script>
 
<body>
 
    <div>
        <input id="time" class="maskTimer" style="width: 100px;" value="120000">
    </div>
 
</body>
</html>

 

After starting the script you see the time this way: 12,00,00 (coma instead of dot as defined in kendoMaskedTextBox -> mask). If you use colon (:) or slash (/) it works fine as well. It also works using f.e. the culture 'de-CH' but not for 'de-AT' (same behaviour as 'de-DE'). I have no clue about this behaviour for other countries. I have no idea why/how the coma overwrites my defined time format. Maybe I'm doing something simple wrong.

Another weird behaviour: If you delete the time in the input field you can see the correct mask: __.__.__ but when you start entering a new time the dot will be replaced by a coma as soon as you pass the first dot (by typing). All weird to me. As far as I know Germany (de-DE) and Austria (de-AT) use : or . as time separator and not a coma, so this can't be any default value for those countries. Can you explain me this or even better what I did wrong?

Regards

Tayger
Top achievements
Rank 1
Iron
 answered on 22 Jan 2018
1 answer
42 views

Hello there

It took me some hours to nail this behaviour down to the problem: I have a time mask in which the user can enter a complete time or some part of a time. Anything left out will be interpreted by my code. After entering the (part) time by the user I do some checks in the change event of the MaskedTextBox and write the validated (part) time back into the MaskTextBox field. In some cases that doesn't work, f.e.:

User enters:     Insert after validation:
10:__:__ AM    10:__:__ __

It should have inserted '10:__:__ AM' (like the original what the user typed)

I have attached a working example to this message. You'll see a MaskedTextBox and you only have to click the button 'Insert time'. This simulates the insert I do after time validation. This will work as it should and inserts '10:__:__ AM', fine! Now disable/remove the CDN script source 'http://kendo.cdn.telerik.com/2017.3.913/js/kendo.all.min.js' and activate/locate the kendo.all.min.js of the downloadable KendoUi of 'kendoui.for.jquery.2017.3.913.commercial.zip': This time the 'AM' will not be inserted by the 'Insert time' button.

I have no idea why it works with the CDN version but not with the downloadable commercial package (same version). I assume there are differencies. To make it even more confusing: Inserting a complete time like '10:10:10 AM' works fine in both cases.
I do already all this with a DATE MaskedTextBox (dd.mm.yyyy) and there it works fine (for full date or part of date).

Greetings

Tayger
Top achievements
Rank 1
Iron
 answered on 09 Oct 2017
1 answer
272 views

I would disable value insertion in the MaskedTextBox, but keep the validator for that field.

I use kendo with MVVM.

This is my html code:

<div>
   <label for="elem" class="elem">Field</label>
   <input data-role="maskedtextbox" data-bind="value: elem1" id="elem" name="element" class="form-control" placeholder="Insert" required validationMessage="Insert {0}" disabled/>
<span class="k-invalid-msg" data-for="element"></span>
</div>

 

Stefan
Telerik team
 answered on 28 Sep 2017
1 answer
90 views

I need to have a mask in the following format: 0000.00.00 where the dot(.) should not act like a decimal placeholder, even with the clearPromptChar

setted to true and promptChar with " " value, after the field lose his focus the decimal placeholder is shown.

 

What I need:

If user types: 1234 - Expected: 1234 - Actual: 1234.  .  

If user types: 12345 - Expected: 1234.5 - Actual: 1234.5  .  

Is this feature available in mask option? it exposes any function where i should format by myself?

 

 

Stefan
Telerik team
 answered on 22 Aug 2017
1 answer
181 views

kendoMaskMaskedTextBox 이벤트를 통해 검도 그리드의 값을 변경하고 싶지만 enter 이벤트 

작동하지 않습니다 어떻게 변환합니까?

{field: "roomNum", title: "Room #", width: "150px", attributes:{style:"text-align:center;"},editor: dateEditor}
 
 function dateEditor(container, options) {
      $('<input data-text-field="' + options.field + '" data-value-field="' + options.field + '" data-bind="value:' + options.field + '"/>')
      .appendTo(container)
      .kendoMaskedTextBox({
          change: function(e){
              var model = options.model;
              assignRoom(model);
             console.log('options-->', options);
          }
      });
};

 

var assignRoom = function(obj) {
        angular.forEach($scope.gridSource.data(), function(v, k) {
            if (v.roomNum === obj.roomNum) {
                if (v.rsvDtlsId !== obj.rsvDtlsId) {
                    v.roomNum = "";
                }
            }              
        });
        var idx = 0, delRoom = null;
        angular.forEach($scope.gridModel, function(v, k) {
            if (v.rsvDtlsId === obj.rsvDtlsId) {
                if (obj.roomNum === "") {
                    delRoom = v.roomNum;
                }
 
                v.roomNum = obj.roomNum;
                idx = k;
            }              
        });
 
        angular.forEach($scope.checkedModel.roomNum, function(v, k) {
            if (v === delRoom) {
                $scope.checkedModel.roomNum[k] = "";
            }              
        });
 
 
        angular.forEach($scope.assignModel, function(v, k) {
            if (v.roomNum === $scope.gridModel[idx].roomNum) {
                $scope.checkedModel.roomNum[idx] = v.roomNum;
            }              
        });
         
        $scope.saveEach(obj);
        $scope.$apply();
    };

kendoMaskedTextBox evnet을 통해 검도 그리드의 값을 변경하고 싶습니다. 그러나 엔터 이벤트가 작동하지 않습니다. 어떻게 변환합니까?

{field: "roomNum", title: "Room #", width: "150px", attributes:{style:"text-align:center;"},editor: dateEditor} 

 function dateEditor(container, options) {
      $('<input data-text-field="' + options.field + '" data-value-field="' + options.field + '" data-bind="value:' + options.field + '"/>')
      .appendTo(container)
      .kendoMaskedTextBox({
          change: function(e){
              var model = options.model;
              assignRoom(model);
             console.log('options-->', options); 
          }
      }); 
};

kendoMaskedTextBox evnet을 통해 검도 그리드의 값을 변경하고 싶습니다. 그러나 엔터 이벤트가 작동하지 않습니다. 어떻게 변환합니까?

{field: "roomNum", title: "Room #", width: "150px", attributes:{style:"text-align:center;"},editor: dateEditor} 

 function dateEditor(container, options) {
      $('<input data-text-field="' + options.field + '" data-value-field="' + options.field + '" data-bind="value:' + options.field + '"/>')
      .appendTo(container)
      .kendoMaskedTextBox({
          change: function(e){
              var model = options.model;
              assignRoom(model);
             console.log('options-->', options); 
          }
      }); 
};

kendoMaskedTextBox evnet을 통해 검도 그리드의 값을 변경하고 싶습니다. 그러나 엔터 이벤트가 작동하지 않습니다. 어떻게 변환합니까?

{field: "roomNum", title: "Room #", width: "150px", attributes:{style:"text-align:center;"},editor: dateEditor} 

 function dateEditor(container, options) {
      $('<input data-text-field="' + options.field + '" data-value-field="' + options.field + '" data-bind="value:' + options.field + '"/>')
      .appendTo(container)
      .kendoMaskedTextBox({
          change: function(e){
              var model = options.model;
              assignRoom(model);
             console.log('options-->', options); 
          }
      }); 
};
Georgi
Telerik team
 answered on 18 May 2017
2 answers
732 views

Hi,

I have a requirement where user can enter numbers with decimals with max length of 10 and the decimal point can occur anywhere within the input. Sample input can be like 1223.4588, 123456.78, 012.45, 678 etc

Can i use the rules option of the maskedtextbox to achieve this. I guess the only option would be to use a regex pattern but it doesn't seem to work. We tried below and also k-mask="'00000.0000'" but none seem to work

$("#id").kendoMaskedTextBox({
   mask: "{{^(?!0\d|\.|.*?\..*?\.)(?=(?:\.?\d){1,10}$)(.*)$}}"
}); 

For requirement above will the numerictextbox serve the purpose ?

Ratno
Top achievements
Rank 1
 answered on 23 Mar 2017
1 answer
83 views

According to the API documentation, the lack of a mask should result in a normal input of type `text` (http://www.telerik.com/kendo-angular-ui/components/inputs/api/MaskedTextBoxComponent/).  I've tried empty string, not setting mask, having a mask of both null and undefined but nothing seems to work.

A simple plunker fork of your demo shows it breaking:

http://plnkr.co/edit/EpmbKmUWNk2Y2zqgj4R6?p=preview

The error I receive is:

EXCEPTION: Error in ./MaskedTextBoxComponent class MaskedTextBoxComponent - inline template:1:8 caused by: Cannot read property 'test' of undefined

 

Also, is there another means to get a standard text input?

Nikolay Rusev
Telerik team
 answered on 13 Mar 2017
3 answers
640 views

The change event doesn't actual change when you change the value; it only fires when the control loses focus.

Even on the Telerik Demo, it only updates the log box when you click off of the control.

How do I make it fire when I am typing in the control itself?

Patrick | Technical Support Engineer, Senior
Telerik team
 answered on 04 Jan 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?