Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-13404

Android: TextField update value on Return event

    Details

      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

          Issue Links

            Activity

              People

              • Assignee:
                vduggal Vishal Duggal (Inactive)
                Reporter:
                timoa Damien Laureaux
                Reviewer:
                Allen Yeung
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-16145
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration