PDA

View Full Version : TextField/ TextArea auto Capitalize



durlabh
28 Aug 2008, 2:35 PM
In my app, I noticed that users always typed in all upper case or lower case but wanted to see the data in Title case. I could have done it on server side too but that leaves no chance for users to correct the cases such as "James McDonald". Hence, wanted to change the text to proper case only if user types in all lower case or upper case. David Gouch had a good extension method for String prototype to convert the string to title case (http://individed.com/code/to-title-case/):

[Code]
Ext.applyIf(String.prototype, {
toTitleCase: function() {
return this.replace(/([\w&`'