Groups | Blog | Home
all groups > flash actionscript > january 2004 >

flash actionscript : Uppercase() Input textfield



Tiago Simões
1/26/2004 10:19:07 PM
hello.


I'm trying to force only the use of Uppercase characters in an input
textfield. That would be easy to do with an addListerner object + onChange
event.

However I would like a way to retrieve into a variable the text input by the
user [uppercase and lowercase] while visually maintaining the Uppercase only
characters.

Is there a way?

thanks,
T.


Jack
1/26/2004 10:58:16 PM

[quoted text, click to view]

hope this helps you on your way,

arr = [];
selection.setFocus(inp1);

inp1.onChanged = function(field){
str = inp1.text;
arr.push(str.charAt(str.length-1));
trace(arr);
inp1.text = inp1.text.toUpperCase();
trace(inp1.text);
};

//btn.onPress = function(){ // or
inp1.onKillFocus = function(inp2){
newStr = "";
for(var n=0;n!=arr.length;n++){
newStr += arr[n];
trace(newStr);
}
};

Tiago Simões
1/27/2004 12:04:42 AM
thanks, sort of what I had in mind.... but:

If the user inserts a new character within those already created, or erases
a large portion of the text or even pastes text from another source this
method will not function.... I want this to work even for those
'exceptional' cases...

It's like having a 'Uppercase' form visually but sending the
'uppercase+lowercase' variable to the PHP form....

cheers,
T.


[quoted text, click to view]

AddThis Social Bookmark Button