how to allow zeros on the left side of number

2 posts, 0 answers
  1. Marco Teodoro
    Marco Teodoro avatar
    53 posts
    Member since:
    Apr 2010

    Posted 25 May 2011 Link to this post

    Hello i'm trying to use maskedinput numeric but i'm not able to use it correctly.

    I need to have a number with the exact lenght of 21 digits but if i my some of my digits are 0 and are placeded in the left part of the number they are beeing ignored.

    how can i have this value (000700150040000000672)  validated.

    i dont want to use masked textbox because of is annoying behaviour - must start writing from left to right.... or is possible to start write whatever i want? if so, i'm sorry for the criticism... 

    sorry if this makes sense to you but does't make any sense to me or my clients... why should i start to write from left?

    can you give an example of how to work with percentages only allowing to decimal digits and a dot as separator? 


    Best Regards, Marco

     
  2. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 30 May 2011 Link to this post

    Hi Marco Teodoro,

    The leading zeros are being removed, as when the text is parsed by the control, they are not taken into consideration as they do not have effect on the value itself. What you can do is set the UpdateValueEvent to LostFocus:

    <telerik:RadMaskedNumericInput UpdateValueEvent="LostFocus" 
                 Mask="#21" Value="{x:Null}" 
                 AllowSkipPlaceholders="True" 
                 AutoFillNumberGroupSeparators="False"
                 AutoFillZeros="False"
                 SelectionOnFocus="CaretToBeginning"/>

    Please note, that the leading zeros will still be removed when the control loses focus. I believe, that in this scenario, it would be more appropriate to work with the text input control.

    <telerik:RadMaskedTextInput Mask="#21" Value="{x:Null}" 
                          SelectionOnFocus="CaretToBeginning"/>
    Could you please give us more details on your last request? For the numeric input, you can use it with the same setup just by changing the token type : Mask="p9.2"

    Greetings,
    Alex Fidanov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
Back to Top