Telerik Forums
Kendo UI for jQuery Forum
1 answer
117 views

I have the following MaskedTextBox:

<input kendo-masked-text-box id="phoneNumber" name="phoneNumber" ng-model="item.phoneNumber" k-mask="'(999) 000-0000'" />​

If I enter (555) 555 it doesnt mark it as invalid.  How do I ensure it is only valid if all digits are entered?

Georgi Krustev
Telerik team
 answered on 14 Sep 2015
5 answers
1.2K+ views

Hi,

 

I'm trying to use the MaskedTextBox to format currency number. However, the fact that we can only set one mask is too limited. For instance, I'd like that if the user write "111", it formats "111". Then if user write an additional number, like "1111", it formats as "1 111", then by adding another number, it formats as "11 111", then "111 111", then "1 111 111" and so on...

 Is this possible?

Konstantin Dikov
Telerik team
 answered on 10 Sep 2015
1 answer
166 views

Hi,

We value the clearOnPromt and unmaskonPost much but it does not provide a simple solution for validating data before posting it. Is there any option to disable the mask getting stored in the model if you haven't completely filled in the textbox? (the _ character).

Its getting ugly without this option, I have multiple masked textboxes where the user don't have to fill in the mask completely but where i use the data to validate before posting. i.e. iban, swift and zip codes. I have to deal multiple times with the mask now.

Thx!

Georgi Krustev
Telerik team
 answered on 08 Jun 2015
2 answers
711 views

Hi all,

Is it possible to use a single regular expession for the masked text box? I have the problem that I want to set the mask for a country-dependent IBAN entry field. The regular expression for Norway, for instance, would be '/^NO[0-9]{2}[0-9]{4}[0-9]{6}[0-9]{1}$/'  while for Romania it would be '/^RO[0-9]{2}[A-Z]{4}[A-Za-z0-9]{16}$/'. They are different in length, different in where there should be letters or digits, etc. I cannot think of a way to easily change the mask/custom rules during runtime. Just setting a single regex would do the trick quickly and easily, if it is supported that is.

 

Regards,

Henk

Henk
Top achievements
Rank 1
 answered on 19 May 2015
1 answer
81 views
Hi all,

I have a decimal field that I have bound to a MaskedTextbox. I have made the mask '999.99'. If I enter ' 45.77' I can see that 45.77 is saved in my database. When I refresh the screen and display the values again I see that '457.7 ' is shown in the MaskedTextbox. How do I get this to work properly and re-dispplay ' 45.77"?

Thanks

Steven
Georgi Krustev
Telerik team
 answered on 23 Mar 2015
4 answers
131 views
I have a MastedTextbox in a form. It is for zip codes that use the 00000-0000 mask. When I send the data to the back-end I strip the -____ off if only 5 digits were entered. This part works fine.

When displaying the form I would like to be able to show the zip code as 12345 (if 5 digits entered) or 12345-6789 (if nine digits were entered). If the MaskedTextbox is in a grid I can do this with a template such as template: '#= (zip) ? formatZipCode(zip) : " " #'. How do I do this in a normal form?

Thanks

Steven
Georgi Krustev
Telerik team
 answered on 18 Mar 2015
1 answer
34 views
http://dojo.telerik.com/etIwa/2


<input id="maskedtextbox" />

<script>
var m = "0ba";
// this should limit the first character to 0-9, the second to 0-5, and the third to 0-2
// but enter the following:
// 9
// left arrow
// 2
// left arrow
// 3
// left arrow
// 8
// left arrow
// 9
// leaves us with "983" - only the first character is "valid"
// basically, after you left arrow it will "push" the existing characters to the right (sometimes, not always) when the next character is entered

$("#maskedtextbox").kendoMaskedTextBox({
mask: m,
    rules: {
      // "0" allows 0-9
      "b": function (char) {
        return (char === "0" || char === "1" || char === "2" || 
                    char === "3" || char === "4" || char === "5");
      },
      "a": function (char) {
        return (char === "0" || char === "1" || char === "2");
      }
    }
});
</script>
Georgi Krustev
Telerik team
 answered on 16 Mar 2015
4 answers
1.7K+ views
Hi,
I am looking for a way to allow users to enter only characters/spaces for the Name field. How is it possible to tell MaskedTextbox to do so? I tried a sample here:
http://dojo.telerik.com/@bhaidar/itIYI/2

The problem is I have to specify the number of fields. Is there a way to leave that open? User can enter as much characters as he/she wants, however, all are characters.

Best regards
Bilal Haidar
Bilal
Top achievements
Rank 2
 answered on 27 Feb 2015
2 answers
53 views
http://dojo.telerik.com/EXODI

creating a mask as described below, the last character should be the number zero.
$("#maskedtextbox").kendoMaskedTextBox({
    mask: "\\1\\0A\\ 00\\ 00\\ 000\\ 00\\ L0\\ \\00",
  value: "100 14 36 085 17 W6 00"
});

when the mask renders it renders as 100 14 36 085 17 W6 0_
it loses the last character.  If the last character is not a zero then it seems to work fine but must be some wierd logic in there where it's causing the last number to be lost.
Georgi Krustev
Telerik team
 answered on 21 Jan 2015
5 answers
267 views
Hi,

I'm trying ot use the MaskedTextBox but, as of today, it's simply unusable because it completely destroys user experience. When the field is empty (for example a credit card), if user enter into the field using the mouse, it should put the caret at the beginning of the field (or, if the field is not empty, at the next supposed character). That's not the case right now, if I click in the middle of the field, it places the caret there, and the input cannot be properly field because of the constraint. You can easily reproduce this in any of your demo.

Is there a way to fix that?

Thanks!
Kiril Nikolov
Telerik team
 answered on 15 Jan 2015
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?