I want users to be able to type a telephone number into a masked text box. This could be a mobile or a landline, so the format can be slightly different. How can I set the mask so that only numbers 0-9 can be entered as well as a space but the format isnt really important
ie
020 123 456
07968 111 333
ie
020 123 456
07968 111 333
5 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 26 Nov 2008, 10:45 AM
Hi Mark Wheeler,
Please check the below link of online demo that demonstrats the desired functionality.
Display Format
Thanks,
Princy.
Please check the below link of online demo that demonstrats the desired functionality.
Display Format
Thanks,
Princy.
0

mww
Top achievements
Rank 1
answered on 26 Nov 2008, 10:59 AM
this doesnt achive the desired functionality, I cant enter any spaces. I need to enter numbers like this
020 123 4567
07902 123 456
020 123 4567
07902 123 456
0
Hello Mark,
It's possible to use regular expressions with regular RadTextBox control as shown in the following forum thread:
RadMaskedTextBox client validation
Regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
It's possible to use regular expressions with regular RadTextBox control as shown in the following forum thread:
RadMaskedTextBox client validation
Regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

mww
Top achievements
Rank 1
answered on 26 Nov 2008, 01:36 PM
that example doesnt work, the value of 'val' in the alphaNumericCheck function is always 'undefined'
0
Hello Mark,
I modified the code for RadControls for ASP.NET AJAX:
Regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I modified the code for RadControls for ASP.NET AJAX:
<script language="javascript" type="text/javascript"> |
function RadTextBox1_KeyPress(sender, args) |
{ |
if (alphaNumericCheck(args.get_keyCharacter())) |
return true; |
else |
{ |
alert("Wrong symbol"); |
return false; |
} |
} |
function alphaNumericCheck(val) |
{ |
var regex = /^[0-9A-Za-z_-]+$/; |
if (regex.test(val)) |
return true; |
else |
return false; |
} |
</script> |
Regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.