Using an app with username and password fields, when a text is entered in the first, then the cursor goes to the second, the value of the first text field is not valid anymore (it takes the password's value).
- Run the following code on Android
- See the logs with adb logcat
- Enter something in the username field (e.g. "foo") - you will see "foo/" in the log
- Click the return button, and start writing something in the password field (e.g. "bar") - you will see "bar/bar" in the log
var win1 = Titanium.UI.createWindow({
backgroundColor:'#fff'
});
var usernameRow = Ti.UI.createTableViewRow({
height: "45dp",
backgroundColor: "#fff",
className: "loginRow",
id: "usernameRow"
});
var __alloyId1 = [];
__alloyId1.push(usernameRow);
var usernameLabel = Ti.UI.createLabel({
left: "5dp",
width: "100dp",
height: Ti.UI.SIZE,
color: "#333",
font: {
fontSize: "16dp"
},
text: "Username",
id: "usernameLabel"
});
usernameRow.add(usernameLabel);
var usernameField = Ti.UI.createTextField({
left: "110dp",
right: "10dp",
width: Ti.UI.FILL,
height: Ti.UI.FILL,
color: "#333",
backgroundColor: "#fff",
autocorrect: !1,
returnKeyType: Titanium.UI.RETURNKEY_NEXT,
id: "usernameField"
});
usernameRow.add(usernameField);
var passwordRow = Ti.UI.createTableViewRow({
height: "45dp",
backgroundColor: "#fff",
className: "loginRow",
id: "passwordRow"
});
__alloyId1.push(passwordRow);
var passwordLabel = Ti.UI.createLabel({
left: "5dp",
width: "100dp",
height: Ti.UI.SIZE,
color: "#333",
font: {
fontSize: "16dp"
},
text: "Password",
id: "passwordLabel"
});
passwordRow.add(passwordLabel);
var passwordField = Ti.UI.createTextField({
left: "110dp",
right: "10dp",
width: Ti.UI.FILL,
height: Ti.UI.FILL,
color: "#333",
backgroundColor: "#fff",
passwordMask: !0,
returnKeyType: Titanium.UI.RETURNKEY_DONE,
id: "passwordField"
});
passwordRow.add(passwordField);
var formView = Ti.UI.createTableView({
left: "10dp",
right: "10dp",
width: Ti.UI.FILL,
backgroundColor: "transparent",
top: "10dp",
height: Ti.UI.SIZE,
borderWidth: "1dp",
borderRadius: 10,
borderColor: "#999",
selectedBackgroundColor: "transparent",
data: __alloyId1,
id: "formView"
});
win1.add(formView);
usernameField.addEventListener("change", function(e) {
Ti.API.info("[---Login---] Connection: " + usernameField.value + "/" + passwordField.value);
});
usernameField.addEventListener("return", function() {
Ti.API.info("[---Login---] Connection: " + usernameField.value + "/" + passwordField.value);
passwordField.focus();
});
passwordField.addEventListener("return", function(e) {
Ti.API.info("[---Login---] Connection: " + usernameField.value + "/" + passwordField.value);
});
win1.open();
The code above is what is generated by Alloy - the bug was found using it. Using SDK 2.1.4 the problem is not visible.
The problem does not seem to be related with Alloy. Updated the bug with a code that replicates the issue with the SDK 3.0.2. I cannot replicate switching back to 2.1.4
Problem is related to className property of the tableView row. If you remove the className from the TableViewRow proxies it works fine
Pull pending against master https://github.com/appcelerator/titanium_mobile/pull/4102
Pull pending https://github.com/appcelerator/titanium_mobile/pull/4102
Backport to 3_1_X https://github.com/appcelerator/titanium_mobile/pull/4205
Tested with: SDK:3.1.1.v20130502180055 Appcelerator Studio: 3.1.1.201305020729 OS: OSX 10.7.5 Device: htc desire(4.0.3) Xcode: 4.6