I have one field in form and i want to put leading zero automatically like if someone put 1 it should write 0001 and if someone write 11 then 0011 but it should be leading zero automatic.
I appreciate quick reply
I have one field in form and i want to put leading zero automatically like if someone put 1 it should write 0001 and if someone write 11 then 0011 but it should be leading zero automatic.
I appreciate quick reply
I don't know if this is valid ASP (I don't know ASP and am judging from my long-ago knowledge of REALBasic), but that's the general idea of it.Code:While Len(Field) < 4 Field = "0" & Field End While
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Its not i want to put only one zero. it can be one or two or three also.it depend on how many digits someone enters.
Exactly. The above loop will pad Field to four digits with zeroes.
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Hi amit1234! I'm also new to ASP...and similarly got the same problem..![]()
I found this code and this was a great help in solving that problem...
http://www.4guysfromrolla.com/demos/FormatDemo.asp
You need to do some itsy bitsy tweaking on it though if you want it to be automatic... =)
Hope it helps!![]()
seraphicmortal![]()
Bookmarks