This is a migrated thread and some comments may be shown as answers.

How to ignore mask literals when inputing values.

3 Answers 38 Views
MaskedEditBox
This is a migrated thread and some comments may be shown as answers.
Karl
Top achievements
Rank 1
Karl asked on 20 Oct 2014, 03:32 PM
I am using the RadMaskedTextBox for a phone number input.  For my situation, when a different country is selected, I am dynamically creating the mask to include the country code.  The behavior I would prefer would be that when the user starts to input numbers, the country code would be ignored.  This works great if the user starts with a number different then the country code.  But, if the user starts with the same number as the country code, the carat only moves through the mask.

To illustrate further.  If the mask is this:  +56 _____________  , and I start typing a phone number that doesn't start with 5, such as 345, the box will look like this : +56 345_______  .   This is fine, and what I would expect.

If, however, I would start typing and the input starts with 5, such as 595, the box will look like this:  +56 95____________ .

This is because the first 5 is being "eaten up" by the mask.   Is there an easy way to disable the mask from "eating up" this input?

Thank you!

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 23 Oct 2014, 10:40 AM
Hello Karl,

Thank you for writing.

This behavior is considered an issue and I have logged it in our Feedback Portal. You can track the item for status changes and add your vote for it here.

To workaround this you can position the caret after the country code. This can be achieved in the GotFocus event:
void radMaskedEditBox1_GotFocus(object sender, EventArgs e)
{
    radMaskedEditBox1.SelectionStart = 3;
    radMaskedEditBox1.SelectionLength = 0;
   
}

Your Telerik Points have been updated for this report.

Should you have any other questions do not hesitate to ask.


Regards,
Dimitar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Karl
Top achievements
Rank 1
answered on 23 Oct 2014, 01:21 PM
Thank you for your reply and for logging this issue to the Feedback Portal.

The code you posted pertaining to the GotFocus event.;  that doesn't seem to be a web-enabled event.  Is there a javascript function that could accomplish this work around for this control on the web?
0
Dimitar
Telerik team
answered on 24 Oct 2014, 03:53 PM
Hello Karl,

Thank you for writing back.

Please note that this is the WinForms forum and I have tested this in a WinForms application. Nevertheless for questions connected with web controls I suggest you to use one of the following forums:
Thank you for your understanding.

Regards,
Dimitar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
MaskedEditBox
Asked by
Karl
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Karl
Top achievements
Rank 1
Share this question
or