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

RadMaskedTextInput allows alphanumeric characters with a numeric mask

13 Answers 386 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Emanuel
Top achievements
Rank 1
Emanuel asked on 07 Aug 2013, 01:07 PM
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...

13 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 09 Aug 2013, 10:55 AM
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 >>
0
Emanuel
Top achievements
Rank 1
answered on 09 Aug 2013, 12:42 PM
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?

0
Petar Mladenov
Telerik team
answered on 12 Aug 2013, 08:20 AM
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 >>
0
Emanuel
Top achievements
Rank 1
answered on 12 Aug 2013, 06:02 PM
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
    }
}






 
0
Accepted
Petar Mladenov
Telerik team
answered on 15 Aug 2013, 01:16 PM
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 >>
0
Sintayehu
Top achievements
Rank 1
answered on 20 Sep 2013, 08:37 PM
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!

0
Petar Mladenov
Telerik team
answered on 23 Sep 2013, 07:56 AM
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 >>
0
Sintayehu
Top achievements
Rank 1
answered on 23 Sep 2013, 01:53 PM
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!
0
Petar Mladenov
Telerik team
answered on 26 Sep 2013, 05:39 AM
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 >>
0
Sintayehu
Top achievements
Rank 1
answered on 28 Jan 2014, 04:03 PM
I have upgraded to Latest 2013 Q3 and the RadMaskedTextInput still accepts non alpha numeric characters with Mask=">a4".

Any thoughts?
0
Petar Mladenov
Telerik team
answered on 31 Jan 2014, 02:06 PM
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 >>
0
Sintayehu
Top achievements
Rank 1
answered on 31 Jan 2014, 02:18 PM
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.
0
Petar Mladenov
Telerik team
answered on 05 Feb 2014, 07:42 AM
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 >>
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Emanuel
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Emanuel
Top achievements
Rank 1
Sintayehu
Top achievements
Rank 1
Share this question
or