Converting to upper case..

  • Thread starter Thread starter Nelson
  • Start date Start date
N

Nelson

In my web form, I am converting all lower case letters to upper case when
the user types the characters in the edit boxes. I am achieving that by
injecting client side script (onkeyup event) for each text box. However if
the user types the characters so fast it may not work.. Also there are some
other loopholes in my code. Is there any approach in ASP.Net to make sure
whenever the user types lower case, the data will be converted to upper
case.

My application is written using ASP.Net (VB.Net, Java Script and .Net Frame
Work 1.1 and TE 5.5+)

Thanks for your answers.

Nelson
 
I don't think there is any, because if users have javascript turned off then
you are still back to the same problem. So, its best to always validate on
the sever (which you can control) to conform to your business rules.
 
Or,
you can use asp.net validation regularexpression control and Force them to
type in all caps. This will not allow the form to be submitted if they
don't. This will validate both on server and on client (if enabled). Probably
the best solution
 
you could convert on the onsubmit event.


function myOnSubmit()
{
var elist = document.getElementsByTagName("INPUT");
for (var i in elist) elist.value = elist.value.toUpperCase();
return true;
}

<form onsubmit="myOnSubmit()" runat="server">


| In my web form, I am converting all lower case letters to upper case when
| the user types the characters in the edit boxes. I am achieving that by
| injecting client side script (onkeyup event) for each text box. However if
| the user types the characters so fast it may not work.. Also there are
some
| other loopholes in my code. Is there any approach in ASP.Net to make sure
| whenever the user types lower case, the data will be converted to upper
| case.
|
| My application is written using ASP.Net (VB.Net, Java Script and .Net
Frame
| Work 1.1 and TE 5.5+)
|
| Thanks for your answers.
|
| Nelson
|
|
 
Back
Top