Welcome to Dream.In.Code
Become an Expert!

Join 149,755 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,448 people online right now. Registration is fast and FREE... Join Now!




formating in textfield?

 
Reply to this topicStart new topic

formating in textfield?

PennyBoki
16 Feb, 2007 - 02:51 PM
Post #1

system("revolution");
Group Icon

Joined: 11 Dec, 2006
Posts: 2,011



Thanked: 7 times
Dream Kudos: 500
Expert In: Java,C++,C

My Contributions
high biggrin.gif
How do I format the textfiled in an HTML file
like 000-000-000 only numbers.
Do I use regular expresions through javascript or????
Just hint or post a link ???
User is offlineProfile CardPM
+Quote Post

rockstar_
RE: Formating In Textfield?
16 Feb, 2007 - 08:41 PM
Post #2

D.I.C Head
Group Icon

Joined: 16 Oct, 2006
Posts: 187


Dream Kudos: 275
My Contributions
QUOTE(PennyBoki @ 16 Feb, 2007 - 03:51 PM) *

Do I use regular expresions through javascript or????

I guess it depends on what you want to do. If you're looking to post through, you could check the post action handler code (perl, python, php, ASP...) and format it then. If you want to do it as the user types it in, you'll want to use some pretty complicated Javascript, or AJAX even. I've used the jQuery library to do something similar.

Anyway, I think you need to be a little more specific on the subject, and then someone can suggest something.

rockstar_
User is offlineProfile CardPM
+Quote Post

PennyBoki
RE: Formating In Textfield?
14 Jul, 2007 - 07:53 AM
Post #3

system("revolution");
Group Icon

Joined: 11 Dec, 2006
Posts: 2,011



Thanked: 7 times
Dream Kudos: 500
Expert In: Java,C++,C

My Contributions
I want to answer my own question since I didn't get the needed answer and I know the answer now(well months ago I ran into this post now so..).
the regular expression for the format yyy-yyy-yyy where y is some number would be:
/[0-9][0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9]/

in javascript you can use that or:
/\d\d\d-\d\d\d-\d\d\d/

the second one goes for javascript

Thank you very much.

This post has been edited by PennyBoki: 14 Jul, 2007 - 01:42 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 05:51AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month