How to ignore mask literals when inputing values.

4 posts, 0 answers
  1. Karl
    Karl avatar
    2 posts
    Member since:
    Jul 2014

    Posted 20 Oct 2014 Link to this post

    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!
  2. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 23 Oct 2014 Link to this post

    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.

     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Karl
    Karl avatar
    2 posts
    Member since:
    Jul 2014

    Posted 23 Oct 2014 in reply to Dimitar Link to this post

    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?
  5. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 24 Oct 2014 Link to this post

    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.

     
Back to Top