JavaScript Formatting Function


Hello there,
I'm having some difficulty writing a JavaScript function to format an input numeric string to "##-## ##/##" format. I have just begun ASP.NET programming and my lead wants me to use JS functions to force the format on textbox. I thought of using MaskEditors but we want to use JS because this JS will be used for other pages also.
Could any one help me with this?
Little more details: It should be numeric. The format ##-## ##/## needs to be forced. If the user enter 63-3, the script should change it to 63-03 00/00. Or if the user enter 63-03 4/5, it should be changed to 63-03 04/05.
I really appreciate your help.
Thanks.
-1
smurtuza
5/4/2009 3:10:05 PM
📁 asp.net.client-side
📃 24353 articles.
⭐ 2 followers.

💬 4 Replies
👁️‍🗨️ 2518 Views



smurtuza:
I thought of using MaskEditors but we want to use JS because this JS will be used for other pages also.

 That also uses JavaScript....
 Eric

Pascarello.com | Twitter epascarello | LinkedIn
-1
A1ien51
5/4/2009 3:42:20 PM

As I mention I'm new to ASP.NET. I think the AJAX Maskeditors cannot be assigned to more that one control. If this has changed please let me know i'll go with that.
 
-1
smurtuza
5/4/2009 3:47:48 PM

smurtuza:

As I mention I'm new to ASP.NET. I think the AJAX Maskeditors cannot be assigned to more that one control. If this has changed please let me know i'll go with that.

 


Why would that matter? Learn to use the Masked Edit controls here: http://www.asp.net/Learn/ajax-videos/video-131.aspx
The JavaScript for that would be a PIA to write and more so to maintain. Using the Masked Edit controls is a pleasant dream in comparison.
NC...
-1
NC01
5/4/2009 5:47:41 PM

 Hi smurtuza,
You can also make use of jQuery mask form input. Just look at the link..
http://www.meiocodigo.com/projects/meiomask/#mm_demos

Please mark as Answer if it helps u. Thanks!

Parth Patel
Techsture Technologies
Software Developer
Ahmedabad
-1
Coool
5/5/2009 5:22:41 AM
Reply: