|
-
Jan 28th, 2008, 06:09 AM
#1
Thread Starter
Lively Member
Restrict phone number to accept only numbers, dashes, plus sign and bracket
i have a text box for user to key in the phone number. I want restrict that textbox to accept only the numbers, dashes, plus sign and bracket. Please advise if this is possible.
-
Jan 28th, 2008, 06:52 AM
#2
Re: Restrict phone number to accept only numbers, dashes, plus sign and bracket
It's possible in a few ways. You can have a javascript method that gets called whenever the textbox's text changes, this method can look for and remove any of the characters that aren't in a predetermined set.
You can use a RegularExpressionValidator in ASP.NET that specifies a regex that would match a valid phone number and have it validate both on client side and codebehind.
-
Jan 28th, 2008, 09:25 AM
#3
Re: Restrict phone number to accept only numbers, dashes, plus sign and bracket
You could also jump into AJAX and use its' masked text boxes.. pretty slick stuff, that AJAX.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|