field.hasText crashes app in iPhone
Hi guys,
coming up against a strange error, I've search this QA but this error was different and on Android.
I have a text field which I need to check has something in, simple I know! But doing the simple check of:
tf1.addEventListener('return', function()
{
if(tf1.hasText()) {
alertMessage = tf1.value;
} else {
alertMessage = 'Nope';
}
tf1.blur();
});
causes the iPhone simulator to kick the app. No errors in the debug console, I've put an alert just before and just after to see flow and the first alert fires but the hasText check throws it.
Any ideas what I am doing wrong? The end result is me checking the input to see if it's a number… So simple but frustrating.
James
3 Answers
-
…Just as easy to just check the value I guess?
if(tf1.value != '') { }
Interested why hasText blows chunks though!
-
I am running into this issue too. I used your work around which works fine, but yes that is weird why hasText() ain't working.
-
Just spent some time wondering why my app keeps crashing…thankfully this Q&A answered it. hasText still crashes the app in the simulator as of 1.2.2