7 Replies - 78583 Views - Last Post: 01 April 2014 - 07:31 AM

#1 nbartow  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 3
  • Joined: 16-June 05

Html Form Force uppercase in Input field?

Posted 16 June 2005 - 08:02 AM

How can you cause a form input field (Type=text) to only accept uppercase characters?

Thanks, Neil
Is This A Good Question/Topic? 1

#101 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1866
  • View blog
  • Posts: 20,278
  • Joined: 17-March 01

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()"/>

Was This Post Helpful? 1

#102 Guest_lucas*


Reputation:

Re: Html Form Force uppercase in Input field?

Posted 17 February 2010 - 05:50 PM

View Postskyhawk133, 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)" />

Was This Post Helpful? 0

#103 Guest_smitsverheij*


Reputation:

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.

<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)" />

Was This Post Helpful? 0

#104 Guest_Matt*


Reputation:

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>
Was This Post Helpful? 0

#105 mauari  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 08-September 11

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....

Was This Post Helpful? 0
  • +
  • -

#106 pisumathu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 01-April 14

Re: Html Form Force uppercase in Input field?

Posted 01 April 2014 - 06:53 AM

simply use :
<input type="text" style="text-transform:uppercase ;" />

Was This Post Helpful? 0
  • +
  • -

#107 laytonsdad  Icon User is offline

  • Cheese and Sprinkles
  • member icon

Reputation: 433
  • View blog
  • Posts: 1,833
  • Joined: 30-April 10

Re: Html Form Force uppercase in Input field?

Posted 01 April 2014 - 07:31 AM

Please don't resurrect dead posts.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1