Help with no-mask

8 posts, 0 answers
  1. Jason D
    Jason D avatar
    72 posts
    Member since:
    Jan 2011

    Posted 30 Sep Link to this post

    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.

  2. Dinko
    Admin
    Dinko avatar
    201 posts

    Posted 05 Oct Link to this post

    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 Enter 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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Jason D
    Jason D avatar
    72 posts
    Member since:
    Jan 2011

    Posted 06 Oct in reply to Dinko Link to this post

    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.
  5. Dinko
    Admin
    Dinko avatar
    201 posts

    Posted 11 Oct Link to this post

    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.
  6. Jason D
    Jason D avatar
    72 posts
    Member since:
    Jan 2011

    Posted 12 Oct in reply to Dinko Link to this post

    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?

  7. Dinko
    Admin
    Dinko avatar
    201 posts

    Posted 17 Oct Link to this post

    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 Mask="" 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.
  8. Jason D
    Jason D avatar
    72 posts
    Member since:
    Jan 2011

    Posted 20 Oct Link to this post

    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.

  9. Dinko
    Admin
    Dinko avatar
    201 posts

    Posted 24 Oct Link to this post

    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!
Back to Top
UI for WPF is Visual Studio 2017 Ready