Last Updated: 17 Oct 2019 08:21 by ADMIN
Created on: 08 Jun 2015 14:36
Category: MaskedTextBox
Type: Bug Report
Leading zeros get removed if string contains only digits.

So i'm trying to use a MaskedTextBox for saving a phone number, but if the string only exists of digits and no other characters in the initial value it will always remove any leading zeros.

This gives me problems for when edit forms where a phone number of 0771234567 is loaded but 771234567 is displayed instead. If someone then clicks save all changes the leading zero is removed. I don't want it just for display either or always put a zero in front because it can also be multiple zeros depending on exit code used e.t.c. (the numbers will be used to call people they are not just for display.)

2.    $Phonenumber = new \Kendo\UI\MaskedTextBox('Phonenumber');
3.    $Phonenumber ->value('0003333');
5.    echo $Phonenumber ->render();

The code above will display '3333' as initial value instead of the desired '0003333', if i use '000test' instead then it works as intended and display '000test'

I don't understand the advantage of always removing leading zeros in this situation, i'd rather do this myself using php if neccesary.

I'm hoping i'm just missing something very simple, no kind of mask seems to help.

The example below will display 3333 as result, where if i would use 000test instead of 0003333 it would show 000test
The example below will display 3333 as result, where if i would use 000test instead of 0003333 it would show 000test
Alex Hajigeorgieva
Posted on: 17 Oct 2019 06:30

Hi, Kachen,

The issue that you are experiencing is not reproducible with the jQuery version:

However, we did manage to reproduce it with the PHP wrappers with the provided snippet:

As a token of appreciation for helping us identify this issue, I have updated your Telerik points. While we cannot commit to a specific timeframe for when the issue will be fixed, you can check the portal here:

Please accept our apology for the inconvenience that this may have caused

Alex Hajigeorgieva
Progress Telerik

Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Posted on: 15 Oct 2019 07:09

I think it bug for MaskedTextBox in PHP UI version.

I also encountered this problem with the PHP UI. When passing value with leading zero.

my code : 

$phone_number = new \Kendo\UI\MaskedTextBox('mobile');
         ->mask("(000) 000-0000");
echo $phone_number->render();

show : 991234567

Solved using javascript instead in my project.

I recommend solving this problem next release.

Georgi Krustev
Posted on: 10 Jun 2015 08:15
Hello Rick,

I answered to the support thread opened on the same subject. Here is a quote of the answer:

The widget will display the defined value based on the widget's mask option. I couldn't see any mask in the given code snippet, which means that the widget will not apply any mask and will output the value unmodified. Here is a demo that demonstrate my statement: As you can see if the mask is correct or no mask is defined, the widget will output the leading zeros.

I would like to ask you continue our discussion in only one thread to avoid any duplication. Thank you for the understanding.

Georgi Krustev
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!