Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > input box which automatically inserts dashes (-'s)

Reply
Thread Tools

input box which automatically inserts dashes (-'s)

 
 
blackoap@gmail.com
Guest
Posts: n/a
 
      09-27-2006
I envision a credit card text input box which only allows numbers and
dashes -'s.... and after you type 4 numbers it inserts a dash, and so
on until the sequence is complete. I have no idea how to write this
JavaScript function except for the dream of how it works. You will
greatly help me expand my capability and learning curve (and help me
finish this dang project!) ... if you can help me with this. Thank you
for any assistance. )

 
Reply With Quote
 
 
 
 
Dr John Stockton
Guest
Posts: n/a
 
      09-27-2006
JRS: In article <(E-Mail Removed). com>,
dated Wed, 27 Sep 2006 10:03:50 remote, seen in
news:comp.lang.javascript, http://www.velocityreviews.com/forums/(E-Mail Removed) posted :
>I envision a credit card text input box which only allows numbers and
>dashes -'s.... and after you type 4 numbers it inserts a dash, and so
>on until the sequence is complete. I have no idea how to write this
>JavaScript function except for the dream of how it works. You will
>greatly help me expand my capability and learning curve (and help me
>finish this dang project!) ... if you can help me with this. Thank you
>for any assistance. )


That gets rather confusing for the unsuspecting typist.

IMHO, it's better to allow anything to be typed, and after that to strip
out all non-digits (with a RegExp) and redisplay the input with spaces
at the intervals that they occur on cards.

It's a good idea to read the newsgroup and its FAQ. See below.
--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://www.jibbering.com/faq/>? JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Width of text input box vs. password input box cjl HTML 1 10-31-2005 11:46 AM
Off Topic: Width of text input box vs. password input box cjl Javascript 7 10-30-2005 10:11 PM
hide the input box or change the color of input box in html ashutosh Java 3 06-16-2005 02:21 PM
regex debugging: alphanumeric with dashes enrique Java 2 05-19-2005 03:27 AM
can i create a xalan java extension function where the function name has dashes (-) in it ? _clb_ Chris Bedford Java 0 08-17-2003 12:57 AM



Advertisments