[MX] Everyone loves Input Validation!

Hi all!

I have an input field where the user can enter a zip code, or a city/state combo (not to be confused with up, up, down, down, left, right, left, rigth, B, A, select, start) to search some things…

The action on my “go” button is as follows, where searchItem is the variable name of the input box:

[AS]on(release){
trace(“THE SEARCH ITEM IS: “+searchItem);
if(typeof searchItem == “number”){
trace(“THIS IS A ZIP CODE SEARCH”);
if(searchItem.length > 5){
trace(“ZIP CODE IS TOO LONG, ANGRY TIGER!”);
}
} else {
searchItem.split(”,”);
searchCity = searchItem[0];
searchState = searchItem[1];
trace(“THIS IS A CITY/STATE SEARCH: “+searchCity+”,”+searchState);
}
}[/AS]

But alas… all the validation fails. It displays searchItem, but not the results of the split, nor does it recognize the variable as a number type when a zip code is entered…

It’s Monday, isn’t it.

Thanks in advance! :hat:

lrhb