Behaviour of IP Address in Masked Edit Box

1 Answer 604 Views
MaskedEditBox
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Toby asked on 14 Dec 2022, 06:13 PM | edited on 15 Dec 2022, 10:17 AM

Hi,

I'm getting weird / unexpected behaviour when using the masked edit box configured to handle IP Addresses.

So using the latest Demo Application, I open up the Masked Edit Box, and in the IP edit box I type in 11.22.33.44

I then double click and highlight the 44 part, and type 6 to replace the 44 with a single 6, however the following is displayed

After clicking on OK this then changes to show the ip address as 11.22.33.255 It seems that clicking on 6 does not replace the 44 but gets inserted at the start of the element. Is there a workaround for this behaviour ?

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 15 Dec 2022, 12:47 PM

Hello, Toby,   

IP addresses consist of four groups each having three or lesser digits. The default mask used by the IPMaskTextBoxProvider is "###.###.###.###"  and it cannot be changed. In case you are having an IP with lesser symbols, you directly type "." or navigate to the next group. Navigation can also be performed using the arrow keys. 

If you would like to use a different mask I can suggest you setting the MaskType as Standard:  

            this.radMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.Standard;
            this.radMaskedEditBox1.Mask = "###.###.###.###";
            this.radMaskedEditBox1.PromptChar = ' ';

The achieved result is demonstrated in the following gif file:

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Toby
Top achievements
Rank 3
Iron
Iron
Iron
commented on 15 Dec 2022, 01:38 PM | edited

Thanks for your response, I have tried it and this solution is considerably worse than using IP address mask.

a) I can no longer advance to the next element using . key if the element only has 1 or 2 digits,

b) I can type 999 as a element,

c) Starting off with 100.120.140.160 if I highlight 120 and enter 5, I get 100.514.016.0 !

d) I can enter - signs

 

Dess | Tech Support Engineer, Principal
Telerik team
commented on 16 Dec 2022, 11:04 AM

Hello, Toby,   

Indeed, you will be allowed to enter "999" as for the MaskType.Standard "#" means optional digit or space. 

I have logged it in our feedback portal by creating a public thread on your behalf. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, due to the specificity of the issue, the possible solution that I can suggest is to use  MaskType.Regex and specify the appropriate regular expression for the Mask property. The following StackOverflow thread offers suitable expressions for the IP validation:

https://stackoverflow.com/questions/5284147/validating-ipv4-addresses-with-regexp  

I hope this information helps.

Tags
MaskedEditBox
Asked by
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or