-XML
<TextField class="username"
hintText="Enter Nickname"
height="40"
width="Ti.UI.CENTER" />
-JS
function signup(e){
alert(is this ur name + "var");
}
i am trying to get a user to enter a username and then put that in a variable to use or display elsewhere. the JS code is an example function of what i want to do. keeping in mind that the xml and js code are not in the same file.
Add an "id" attribute to the TextField, so that you can access it in the controller, for example, modifying your code, lets assume the Alloy controller is named "GetUsername":
/* GetUsername.xml */
<Alloy>
<TextField id="usernameInput" class="username"
hintText="Enter Nickname"
height="40"
width="Ti.UI.CENTER" />
</Alloy>
This is the controller JS file that backs up the view:
/* GetUsername.js */
function signup(e){
alert("is this ur name " + $.usernameInput.value);
}