How can you cause a form input field (Type=text) to only accept uppercase characters?
Thanks, Neil
Html Form Force uppercase in Input field?
Page 1 of 15 Replies - 58443 Views - Last Post: 08 September 2011 - 04:07 AM
#101
Re: Html Form Force uppercase in Input field?
Posted 16 June 2005 - 08:25 AM
You can't really limit input to uppercase, but you can definitley convert the entire string to uppercase after they've typed... this is probably better:
<input type="text" onblur="this.value=this.value.toUpperCase()"/>
#102 Guest_lucas*
Re: Html Form Force uppercase in Input field?
Posted 17 February 2010 - 05:50 PM
skyhawk133, on 16 June 2005 - 07:25 AM, said:
You can't really limit input to uppercase, but you can definitley convert the entire string to uppercase after they've typed... this is probably better:
<input type="text" onblur="this.value=this.value.toUpperCase()"/>
actually, that wont work..
you might want to use a function like this:
<script>
function caps(id){
document.getElementById(id).value = document.getElementById(id).value.toUpperCase();
}
</script>
and then on the form elements:
<input name="text" type="text" id="text" onblur="caps(this.id)" />
#103 Guest_smitsverheij*
Re: Html Form Force uppercase in Input field?
Posted 21 April 2010 - 03:48 AM
The first example works fine. And above code a bit nicer.
and then on the form elements:
<script>
function caps(element){
element.value = element.value.toUpperCase();
}
</script>
and then on the form elements:
<input name="text" type="text" id="text" onkeyup="caps(this)" />
#104 Guest_Matt*
Re: Html Form Force uppercase in Input field?
Posted 24 September 2010 - 01:42 PM
Also can attach the onkeyup event handler to the input box, as in:
<input type="text" ... other stuff ... onkeyup="javascript:this.value=this.value.toUpperCase()"></input>
<input type="text" ... other stuff ... onkeyup="javascript:this.value=this.value.toUpperCase()"></input>
#105
Re: Html Form Force uppercase in Input field?
Posted 08 September 2011 - 04:07 AM
<span style="text-transform: uppercase" type='text'>
TEXT TO DISPLAY IN UPERCASE HERE
<code></span></code>
AnY oNe CaN tYpE aNy MoDo In ThE InPuT fIeLd ThIs LiNe MaKe DiSpLaY aLl In UpErCaSe
<span style="text-transform: uppercase" type='text'>ANY ONE CAN TYPE ANY MODE IN THE INPUT FIELD THIS LINE MAKE DISPLAY ALL IN UPERCASE
</span)
faster and furios....
Page 1 of 1
|
|

New Topic/Question
Reply

MultiQuote





|