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

Help with no-mask

7 Answers 256 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Jason D
Top achievements
Rank 1
Veteran
Jason D asked on 30 Sep 2016, 09:10 PM

This is my first time using the masked input and I could use some help. I don't want the placeholder, so I'm using Mask="". In this example, I want to restrict to positive integers only (or blank if it's an optional input). I can restrict the numeric version to digits only, but how do I prevent the negative sign?

I would actually prefer to use the normal masked input and simply limit it to the characters 0-9. However when I use Mask="", I have not been able to restrict the inputs using the FormatString. It's still allowing me to type anything.

7 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 05 Oct 2016, 01:42 PM
Hi Jason D,

To restrict the input to be only positive numbers you can set the MaskedInputExtensions.Minimum attached property to 0. 
<telerik:RadMaskedNumericInput maskedInput:MaskedInputExtensions.Minimum="0" />
You can check the How to Only Positive Numbers help article in our documentation for further information.

Regards,
Dinko
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Jason D
Top achievements
Rank 1
Veteran
answered on 06 Oct 2016, 08:19 PM
I will try it when I get a chance. However, how do I use the no-mask feature with the non-numeric input? I can't get the FormatString to restrict any input.
0
Dinko | Tech Support Engineer
Telerik team
answered on 11 Oct 2016, 10:15 AM
Hi Jason D,

I am not sure that I have correctly understood your requirement. I would ask you to elaborate more on what you do you mean by "I can't get the FormatString to restrict any input." . Also which mask (RadMaskedTextInput, RadMaskedNumericInput etc.) are you using?

Regards,
Dinko
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Jason D
Top achievements
Rank 1
Veteran
answered on 12 Oct 2016, 08:26 PM

Sorry, I've been really busy. As an example, I want to limit the input to two characters from 0-9. So the user should be allowed to type anything from 0 to 99. I do not want a placeholder, so in all instances, Mask="".

I want to use RadMaskedTextInput. What values are allowed in the FormatString to control the input? The documentation states that this control can use No-mask, but doesn't state how to use FormatString with it.

http://docs.telerik.com/devtools/wpf/controls/radmaskedinput/features/common

I've tried setting the FormatString to the following values, but none of them affect what the user is allowed to type.

AA
00

For a completely different non-numeric example, I want to restrict the user to entering only one letter (A-Z). How would I do that using no-mask?

0
Dinko | Tech Support Engineer
Telerik team
answered on 17 Oct 2016, 08:54 AM
Hello Jason D,

Using the FormatString property of the control you can't restrict the input. From your last reply, we assumed that you are using  because you don't want placeholders. If this is the case you can use the Placeholder property and override the default value. You can check the Placeholder help article in our documentation where this property is further described. Below you can check two suggestion which you can try for the mentioned approach in your last reply.

In you first approach you want to restrict the input to positive number from 0 to 99. You can use the RadMaskedNumericInput with the MaskedInputExtensions.Minimum  attached property setting to 0 and Mask property set to "AA" to restrict the input to two numbers.
<telerik:RadMaskedNumericInput  Mask="AA"
                  Width="250"
                  Placeholder=" "
                  maskedInput:MaskedInputExtensions.Minimum="0"/>

For the non-numeric input, you can use RadMaskedTextInput control. Here you can set the mask to "L1" so only one letter can be enter. In addition, you can add Upper token to the mask so that the entered letter always is upper case. You can check the Modifier Tokens section in the Mask Tokens help article. 
<telerik:RadMaskedTextInput Mask="&gt;L1" Width="250" Placeholder=" "/>

Give this approaches a try and let us know if they work for you.
Regards,
Dinko
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Jason D
Top achievements
Rank 1
Veteran
answered on 20 Oct 2016, 06:07 PM

I think it's not possible. Setting the placeholder to a space then shows spaces in the textbox which is not acceptable. The documentation states that using no-mask with RadMaskedTextInput is possible (true), but it appears if you do that, it's impossible to control the input. However you *can* control it when using the RadMaskedNumericInput. If that's true, the documentation should be corrected.

I've seen several posts of people trying to get rid of the placeholder so I would suggest allows no placeholder while using the Mask.

For non-numeric input restriction, I will just use a normal text box and validate the user's text myself.

0
Dinko | Tech Support Engineer
Telerik team
answered on 24 Oct 2016, 02:02 PM
Hello Jason D,

Thank you for your feedback. We appreciate any feedback given from our customers. We have logged this article in our backlog for further updating. 

Another approach wich you can try to clear the placeholder is to create a custom style and set the Placeholder to a Zero Width No-Break Space Unicode character. For example:
<Style TargetType="telerik:RadMaskedTextInput">
    <Setter Property="Placeholder">
        <Setter.Value>
            &#xFEFF;
        </Setter.Value>
    </Setter>
</Style>

Hope this is helpful.

Regards,
Dinko
Telerik by Progress
Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Jason D
Top achievements
Rank 1
Veteran
Answers by
Dinko | Tech Support Engineer
Telerik team
Jason D
Top achievements
Rank 1
Veteran
Share this question
or