how to enter phone number in special format?

L

Luc

Hi,

i created a form with a textbox where the user must enter his phone number,
bank account number etc .... Does it exist a way to make the textbox with a
specific format e.g. 'ddd/dddddd' (d = digit) for phone or 'ddd-dddddd-dd'
for bank account number?

Thanks for tips
Luc
 
A

Andrew Morton

Luc said:
i created a form with a textbox where the user must enter his phone
number, bank account number etc .... Does it exist a way to make the
textbox with a specific format e.g. 'ddd/dddddd' (d = digit) for
phone or 'ddd-dddddd-dd' for bank account number?

The best way would be to let the user enter the data however they want to
and then your program validates it and coerces it into whatever other format
you need.

That way, they don't have to worry about whether or not you're expecting
dashes or slashes or whatever.

Andrew
 
G

Gregory A. Beamer

i created a form with a textbox where the user must enter his phone
number, bank account number etc .... Does it exist a way to make the
textbox with a specific format e.g. 'ddd/dddddd' (d = digit) for
phone or 'ddd-dddddd-dd' for bank account number?

The ASP.NET AJAX bits have this (as Mark mentioned):
http://snurl.com/t9lce

jQuery has some nice plugins that do the same thing, so you might go
this direction if you are not yet sold on AJAX. NOTE that MS is adding
jQuery to its websites in .NET 4.0, so it is not an "out on a limb"
decision where you will be left high and dry.

You can also code a JavaScript routine that checks input and refuses
input that does not fit a certain mask. That is how the various "plug
ins" are written. I would not personally do this, as I don't believe in
reinventing the wheel (when the wheel is adequate), but it is a useful
learning exercise if you are not as well versed in JavaScript.

Peace and Grace,
Greg

--
Vote for Miranda's Christmas Story
http://tinyurl.com/mirandabelieve

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
L

Luc

thanks to all

Gregory A. Beamer said:
The ASP.NET AJAX bits have this (as Mark mentioned):
http://snurl.com/t9lce

jQuery has some nice plugins that do the same thing, so you might go
this direction if you are not yet sold on AJAX. NOTE that MS is adding
jQuery to its websites in .NET 4.0, so it is not an "out on a limb"
decision where you will be left high and dry.

You can also code a JavaScript routine that checks input and refuses
input that does not fit a certain mask. That is how the various "plug
ins" are written. I would not personally do this, as I don't believe in
reinventing the wheel (when the wheel is adequate), but it is a useful
learning exercise if you are not as well versed in JavaScript.

Peace and Grace,
Greg

--
Vote for Miranda's Christmas Story
http://tinyurl.com/mirandabelieve

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top