Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13404] Android: TextField update value on Return event

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2013-05-03T10:16:36.000+0000
Affected Version/sn/a
Fix Version/s2013 Sprint 08 API, 2013 Sprint 08, Release 3.1.1, Release 3.2.0
ComponentsAndroid
LabelsSupportTeam, qe-testadded, regression
ReporterDamien Laureaux
AssigneeVishal Duggal
Created2013-04-05T14:01:18.000+0000
Updated2013-10-31T23:00:06.000+0000

Description

Description of the problem

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).

Steps to reproduce

- 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();

Additional info

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.

Attachments

FileDateSize
titanium-bug-android-textfield-value.zip2013-04-05T14:01:18.000+00007399602

Comments

  1. Davide Cassenti 2013-04-05

    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
  2. Vishal Duggal 2013-04-05

    Problem is related to className property of the tableView row. If you remove the className from the TableViewRow proxies it works fine
  3. Vishal Duggal 2013-04-05

    Pull pending against master https://github.com/appcelerator/titanium_mobile/pull/4102
  4. Vishal Duggal 2013-04-05

    Pull pending https://github.com/appcelerator/titanium_mobile/pull/4102
  5. Vishal Duggal 2013-04-22

    Backport to 3_1_X https://github.com/appcelerator/titanium_mobile/pull/4205
  6. Anshu Mittal 2013-05-03

    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

JSON Source