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

RadMaskedTextBox interperts delete key as space

2 Answers 67 Views
Input
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 2
John asked on 14 Nov 2013, 09:18 PM
I've got a strange issue where the RadMaskedTextBox will accept a delete keystroke as a space character (overwriting any previous value and advancing the cursor) when the mask is set to accept only numbers. Expected functionality is for the delete key to delete the character to the immediate right of it, and for the cursor to remain in the same place.

Suppose my RadMaskedTextBox has the following input

1234
 ^---Cursor
after delete key press
 234
  ^---Cursor
after delete key press
  34
   ^---Cursor
after delete key press
   4
    ^---Cursor
after delete key press   
     ^---Cursor

<telerik:RadMaskedTextBox ID="txtbox" class="numeric" PromptChar=""  SelectionOnFocus="SelectAll"
 runat="server" Width="44px" MaxLength="4" Mask="####" DisplayMask="****" DisplayText="" TabIndex="4"
   HideOnBlur="True" AutoCompleteType="Disabled"></telerik:RadMaskedTextBox>

Reproduced on latest Firefox and Chrome. Using v2013.3.1114.40

2 Answers, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 19 Nov 2013, 10:09 AM
Hello John,

It is the expected behavior, because it is masked box. You have specific mask, and chars inside in exact location of the mask that they could not be placed in different location.

When you delete a char, it will be invalid to move all right chars to left.

For example
If you have mask:
"(###)###-####"
And you have entered
"(#11)234-9999"
And you delete the first "1"
It should be like:
"(##1)234-9999"
And not like
"(#1)234-9999?" //because it is invalid, and does not match the mask.
"(###)###-####"

If you do not want the masked behavior, then use regular RadNumericTextBox for your case.

Regards,
Vasil
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
John
Top achievements
Rank 2
answered on 20 Nov 2013, 12:26 PM
Hi Vasil,

Thank you for your reply. It makes a lot of sense. I cannot use a NumericTextBox however, as I need leading zeros to be preserved.

Thanks,

John
Tags
Input
Asked by
John
Top achievements
Rank 2
Answers by
Vasil
Telerik team
John
Top achievements
Rank 2
Share this question
or