RadMaskedTextInput allows alphanumeric characters with a numeric mask

14 posts, 1 answers
  1. Emanuel
    Emanuel avatar
    7 posts
    Member since:
    Jul 2013

    Posted 07 Aug 2013 Link to this post

    Hi, we just upgrade to Q2 2013 SP1

    I use the RadMaskedTextInput with a numeric mask like this '##-######' ( the behavior expected is  '123-456789' ) , in an earlier version this works fine, but now with the newest version it's allows alphanumeric characters and appears a tooltip with the message 'Invalid Input'.

    There is a way to prevent alphanumeric characters with the numeric mask implemented ??


    Notes: We can't use RadMaskedNumericInput with the mentioned mask ( '##-######' ) because the '-' minus character, so we use the RadMaskedTextInput .

    Sorry my english...
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 09 Aug 2013 Link to this post

    Hi Emanuel,

     Could you please send us your XAML and your ViewModels (if any) ? This will help us better investigate the issue ? What are the exact settings that used to work before and are broken in Q3 2013 SP?

    Regards,
    Petar Mladenov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
  4. Emanuel
    Emanuel avatar
    7 posts
    Member since:
    Jul 2013

    Posted 09 Aug 2013 Link to this post

    Hi Petar. Thank you for your answer...

    Just Is a basic implementation of the control, the problem is the difference between the current and previous version..

    The code is the same....I only change the DLL version...


    public string FederalEmployerIdentificationNumber { get; set; }


    <telerik:RadMaskedTextInput x:Name="maskFeinNumber" Grid.Column="1" TabIndex="15" Width="167" Height="24"
    Value="{Binding Path=CurrentClient.FederalEmployerIdentificationNumber, Mode=TwoWay}"
    Mask="##-#######" IsClearButtonVisible="False" InputBehavior="Replace" />

    Now alphanumeric characters are allowed if you use a numeric mask, even in the official demo. How I prevent this..? I can suscribe to the KeyDown event to try  handle this scenario,  but does not work how is expected. There is a way to make it work like the previous version?

  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 12 Aug 2013 Link to this post

    Hello Emanuel,

    Alphanumeric usually refers to mixture of alphabetic and numeric characters. Do you mean that you need to disallow users to type alphabetic characters only ? If yes, you can try the approach from this help article.
    It is also important for us to know what is your previous version of RadControls ?

    Regards,
    Petar Mladenov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  6. Emanuel
    Emanuel avatar
    7 posts
    Member since:
    Jul 2013

    Posted 12 Aug 2013 Link to this post

    Thank you for your reply Petar.

    Yes is exactly what I need, but even implementing the custom token has the same behavior than the token #.

    I submitted a ticket support (725682 ) with two samples for two differents releases. The first correspond to the Q3 2012 SP1 (MaskedInputSamplePrevious) and the second correspond to the Q2 2013 SP1 (MaskedInputSampleLast). 
    Note that the code is the same for both ( It's include an NUMERIC mask ) in the previous version you can not type an alphabetic character and in the last version it is allowed. Even with custom token, the result is the same behavior unexpected. I want only enter Numeric characters!! like in the oldest version.

    How I mentioned , I was trying with custom tokens like you suggest. But still allowed alphabetic characters.

    using System.Linq;
    using Telerik.Windows.Controls.MaskedInput.Tokens;
     
    namespace SLCast.Common.Helpers
    {
        public class NumericMaskToken : ITokenValidationRule
        {
            #region ITokenValidationRule Members
     
            public bool IsRequired
            {
                get return false; }
            }
     
            public bool IsValid(char ch)
            {
                return ValidChars.Contains(ch);
            }
     
            public char Token
            {
                get return '$'; }
            }
     
            public TokenTypes Type
            {
                get return TokenTypes.AlphaNumeric; }
            }
     
            private string myValidChars = "0123456789";
     
            public string ValidChars
            {
                get return myValidChars; }
            }
     
            #endregion
        }
    }






     
  7. Answer
    Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 15 Aug 2013 Link to this post

    Hello Emanuel,

     This appears to be abug in our MaskedTextInput introduced in Q2 2013 SP. We logged it in PITS and we will try to fix it for some of the next internal builds. Please excuse us for the inconvenience caused.

    Regards,
    Petar Mladenov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  8. Sintayehu
    Sintayehu avatar
    67 posts
    Member since:
    Jan 2013

    Posted 20 Sep 2013 Link to this post

    Hello,

    In my case I am on version : 2012 Q2 and I am using the Alpha Numeric mask as Mask=">A4" on the RadMaskedTextInput.

    I am expecting that it will allow me to enter a-z , A-Z, 0-9 and it does a good job at that but it also lets me enter all other characters.

    Tried this on the demo site which is 2013 Q2 but exhibits similar issue.

    Is there a different token I should be using? I would just like to disallow entering of characters other than alpha numeric ones.

    I'll take any workaround, I am already extending the control.

    Thanks!

  9. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 23 Sep 2013 Link to this post

    Hello Sintayehu,

     We highly encourage you to avoid workarounds in this scenario. Actually this issue is already resolved and the fix is included in our latest internal builds as well as in the upcoming Q3 Official Release next month.

    Regards,
    Petar Mladenov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  10. Sintayehu
    Sintayehu avatar
    67 posts
    Member since:
    Jan 2013

    Posted 23 Sep 2013 Link to this post

    Although it would be ideal we can not currently upgrade to latest version; every upgrade takes lots of regression testing and possible fixes for us since we extend and theme lots of controls.

    So for now I will need a workaround for 2012 Q2 if there is any.

    Thanks!
  11. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 26 Sep 2013 Link to this post

    Hello Sintayehu,

     You can try using the ValueChanging event and prevent value from updating if it contains non-alphanumeric symbols. In an MVVM scenario you can perform this validation in the setter of the ViewModels string property which is bound to the Value of the MaskedTextInput.
    We hope this will help you proceed further.

    Regards,
    Petar Mladenov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  12. Sintayehu
    Sintayehu avatar
    67 posts
    Member since:
    Jan 2013

    Posted 28 Jan 2014 in reply to Petar Mladenov Link to this post

    I have upgraded to Latest 2013 Q3 and the RadMaskedTextInput still accepts non alpha numeric characters with Mask=">a4".

    Any thoughts?
  13. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 31 Jan 2014 Link to this post

    Hello Sintayehu,

    I think I have mislead you in my previous post in this thread. I've thought you mean this issue:

    MaskedInput: Using alphabetic symbols in "####" masks is possible but it should not. Introduced in Q2 2013 SP.

    This is the issue that is fixed in Q3.

    As for entering symbols like "-", ".", "/", "\" we have always allowed entering such ones with Mask = A2, A3, A 20 etc. Even our help demonstrates such symbols with Mask=AAAAA. That is why we cannot change this behavior out of the box - this will be a breaking change.
    To workaround this you can use the ValueChanging event of the MaskedInput controls.

    Please again excuse me for the inconvenience caused.

    Regards,
    Petar Mladenov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  14. Sintayehu
    Sintayehu avatar
    67 posts
    Member since:
    Jan 2013

    Posted 31 Jan 2014 in reply to Petar Mladenov Link to this post

    Hi I can not use valuechanging event because I am using update on lost focus. The event doesn't get raised as user types so I can't prevent this non Alpha Numeric characters.
  15. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 05 Feb 2014 Link to this post

    Hello Sintayehu,

    We used Custom Tokens following this help article and created a sample project for you.
    The idea is that you can create mask token that accepts only certain range of symbols:
    public char Token
          {
              get { return '$'; }
          }
     
          public TokenTypes Type
          {
              get { return TokenTypes.AlphaNumeric; }
          }
     
          private string myValidChars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    Could you please take a look at the project and let us know if this fits well in your scenario ?

    Regards,
    Petar Mladenov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
DevCraft banner