how to enter phone number in special format?

  • Thread starter Thread starter Luc
  • Start date Start date
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
 
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
 
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! |
*******************************************
 
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! |
*******************************************
 
Back
Top