NimbleKit - fast iOS app development

Text Field - getString

Ask questions and share your skills here

Text Field - getString

Postby tarnfeld » Fri Sep 25, 2009 11:45 pm

For some reason, when i alert out the value of for example
var ur = window.textField.getString();
It gives me "(null)"!
Any idea why? :(
tarnfeld
 
Posts: 189
Joined: Mon Jun 15, 2009 9:37 pm

Re: Text Field - getString

Postby sunny » Sat Sep 26, 2009 12:56 am

because textfield is not part of window, it's NimbleKit class instance, remove "window." and it should work
User avatar
sunny
Staff
 
Posts: 2669
Joined: Sat May 30, 2009 5:18 am
Location: Palo Alto, California

Re: Text Field - getString

Postby tarnfeld » Sat Sep 26, 2009 10:41 am

Ah ah ah ok :D
Hahahahah!!
I only use window, so i can share the variable over the whole javascript and functions over the page...
tarnfeld
 
Posts: 189
Joined: Mon Jun 15, 2009 9:37 pm

Re: Text Field - getString

Postby tarnfeld » Sat Sep 26, 2009 10:48 am

*UPDATE*
This makes no difference! :( :(
tarnfeld
 
Posts: 189
Joined: Mon Jun 15, 2009 9:37 pm

Re: Text Field - getString

Postby sunny » Sat Sep 26, 2009 11:16 am

nobody can help you unless you show code how you created it at least
User avatar
sunny
Staff
 
Posts: 2669
Joined: Sat May 30, 2009 5:18 am
Location: Palo Alto, California

Re: Text Field - getString

Postby tarnfeld » Sat Sep 26, 2009 12:13 pm

fair enough
Code: Select all
var textField = new NKTextField(); 
textField.init(24, 113, 270, 32);
textField.setKeyboardType("URL");
textField.show();


This works, to show it..... but if i had this,

Code: Select all
<head>
<script>
function hello{
NKAlert("hi", textField.getString());
}
</head>
<body>
<script>
var textField = new NKTextField();
textField.init(24, 113, 270, 32);
textField.setKeyboardType("URL");
textField.show();
</script>
<input type="button" onclick="hello
();">
</body>


I would be alerted (null)?
tarnfeld
 
Posts: 189
Joined: Mon Jun 15, 2009 9:37 pm

Re: Text Field - getString

Postby sunny » Sat Sep 26, 2009 12:32 pm

It does not work cause it's in different sections (<head> and <body>), move them to one section.
I will check that further, it returns (null) when textfield is empty but should return empty string...
User avatar
sunny
Staff
 
Posts: 2669
Joined: Sat May 30, 2009 5:18 am
Location: Palo Alto, California

Re: Text Field - getString

Postby tarnfeld » Sat Sep 26, 2009 12:39 pm

Yah thats what i was thinking?
I will try moving them to see if that makes a difference :)
Is it worth fiddling around with UIPasteBoard now to get my update out on the app store, if 1.6 is a long way away? :)
tarnfeld
 
Posts: 189
Joined: Mon Jun 15, 2009 9:37 pm

Re: Text Field - getString

Postby sunny » Sat Sep 26, 2009 12:45 pm

well, 1.6 will be in beta stage next week probably and released in two weeks, but this is not for sure
User avatar
sunny
Staff
 
Posts: 2669
Joined: Sat May 30, 2009 5:18 am
Location: Palo Alto, California

Re: Text Field - getString

Postby tarnfeld » Sat Sep 26, 2009 12:48 pm

Ah ok, so its worth waiting :)
I have moved it and nothing.... it still returns null?
tarnfeld
 
Posts: 189
Joined: Mon Jun 15, 2009 9:37 pm

Next

Return to How To...

Who is online

Users browsing this forum: Bing [Bot] and 2 guests