Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Correct The Case Of a Value Entered In an HTML Form

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0

Is there a way in ASP to turn the value entered into an HTML text box to PROPER CASE, and by PROPER CASE I mean the first letter CAPS and the rest LOWER CASE. I know it can be done using javascript, but I was wondering if there is any other way to do it.
Thanks for your help.
Kash
 
Hi,

you can use LCase and UCase functions in ASP, examples:

Response.Write LCase("Good Morning") 'good morning
Response.Write UCase("Good Morning") 'GOOD MORNING

hope this helps, Chiu Chan
WebMaster & Software Engineer
emagine solutions, inc
cchan@emagine-solutions.com
 

Thanks for your reply Chan, is there a command for PROPER CASE in ASP?

so that when someone types "gOoD mOrNiNg" it changes it to "Good Morning"

 
Hi,

hmm... try this,

MyMessage = "gOoD mOrNiNg" 'gOoD mOrNiNg
MyMessage = LCase(MyMessage) 'good morning

a_MyMessage = Split(MyMessage, " ")

NewMessage = ""
For i = 0 to UBound(a_MyMessage)
NewMessage = NewMessage & " " & Replace(a_MyMessage(i), Left(a_MyMessage(i),1), UCase(Left(a_MyMessage(i),1)),1,1)
Next

NewMessage = Trim(NewMessage) ' Good Morning '
Response.Write(NewMessage) 'Good Moring'

hope this helps, Chiu Chan
WebMaster & Software Engineer
emagine solutions, inc
cchan@emagine-solutions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top