# Forcing ALL CAPS in an input text box

**URL:** <https://forum.kirupa.com/t/forcing-all-caps-in-an-input-text-box/27285>\
**Category:** flash\
**Created:** [July 31, 2003, 8:38pm UTC](https://forum.kirupa.com/t/forcing-all-caps-in-an-input-text-box/27285 "2003-07-31T20:38:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eilorux](https://avatars.discourse-cdn.com/v4/letter/e/57b2e6/32.png) [@eilorux](https://forum.kirupa.com/u/eilorux)\
**Post date:** [July 31, 2003, 8:38pm UTC](https://forum.kirupa.com/t/forcing-all-caps-in-an-input-text-box/27285/1 "2003-07-31T20:38:07Z")

</div>

I’m creating a flash-based login prompt for user name and password and I want to force the user names to be all caps. Is there a simple way to get this accomplished?

Thanks,

James

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 31, 2003, 8:42pm UTC](https://forum.kirupa.com/t/forcing-all-caps-in-an-input-text-box/27285/2 "2003-07-31T20:42:44Z")

</div>

[AS]myTextField.restrict = “A-Z”;  
// another option  
myTextField.restrict = “^a-z”;[/AS]  
[http://www.macromedia.com/support/flash/action\_scripts/actionscript\_dictionary/actionscript\_dictionary762.html](http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary762.html)

😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 31, 2003, 8:53pm UTC](https://forum.kirupa.com/t/forcing-all-caps-in-an-input-text-box/27285/3 "2003-07-31T20:53:17Z")

</div>

or

```auto
myTextField = myTextField.toUpperCase();

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 31, 2003, 8:57pm UTC](https://forum.kirupa.com/t/forcing-all-caps-in-an-input-text-box/27285/4 "2003-07-31T20:57:23Z")

</div>

You’ll need an onChanged handler to get that code to work properly…  
[AS]myTextField.onChanged = function() {  
this.text = this.text.toUpperCase();  
};[/AS]
