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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to force input box to uppercase

Status
Not open for further replies.

schwankieog

Programmer
Jul 25, 2001
43
0
0
US
to properly run an sql statement in the enviroment i am working in I need to be able to enter field values in all upper case. thus i need to be able to force the input of a input box to be uppercase. i know i can write a conversion function but i would rather do it this way f a t all possible. i appreciate your help.
 
you could do it using some javascript like the following

<script language=&quot;javascript&quot;>
function UCase(textBox){
var upperCase = &quot;&quot;;
upperCase = textBox.value;
textBox.value = upperCase.toUpperCase();
}
</script>


<input name=&quot;UserID&quot; value=&quot;&quot; onKeyUp=&quot;UCase(frmLogin.UserID)&quot;>
 
Or even shorter
<script>
function upCaseCtrl(ctrl)
{
ctrl.value = ctrl.value.toUpperCase();
}
</script>

<form>
<input type=&quot;text&quot; value onChange=&quot;upCaseCtrl(this) &quot;> Eric

Starting GA/AL Focus User Group (FUSE) in Atlanta. See IBI website for usergroup info or contact me at eric.searing@wcom.com.
 
if you are looking for shortness, couldnt you just:

<input type=text value=&quot;&quot; onchange=&quot;this.value=this.value.toUpperCase();&quot;>

Robert Carpenter
questions? comments? thanks? email me!
linkemapx@hotmail.com
Icq: 124408594
online.dll

AIM & MSN: robacarp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top