{ "id": "161550", "key": "TIMOB-23611", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "11", "description": "Is not a bug in our product", "name": "Not Our Bug" }, "resolutiondate": "2016-11-17T00:19:09.000+0000", "created": "2016-07-02T02:37:30.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-21T20:51:31.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "h6.Reproduce Problem\r\n1. Add following code to app.\r\n{code}\r\nvar win = Ti.UI.createWindow({});\r\n \r\nvar view = Ti.UI.createView();\r\n\r\nvar tf = Ti.UI.createTextField({ \r\n\ttop: 50, \r\n\twidth: Ti.UI.FULL, \r\n\tright: 20, \r\n\tleft: 20, \r\n\tkeyboardType: Ti.UI.KEYBOARD_DECIMAL_PAD, \r\n\tmaxLength: 12, \r\n\tborderWidth: 1, \r\n\tborderColor: \"black\", \r\n\tsuppressReturn: true, \r\n\tbottom: 20, \r\n\theight: Ti.UI.SIZE \r\n}); \r\n\r\n\r\nvar btnchange = Ti.UI.createButton({ \r\n\ttitle: \"change\" \r\n}); \r\n\r\nbtnchange.addEventListener('click', function() { \r\n\ttf.value = '213-33'; \r\n\ttf.setSelection(tf.value.length, tf.value.length);\r\n}); \r\n\r\nview.add(tf); \r\nview.add(btnchange); \r\nwin.add(view); \r\n\r\nwin.open();\r\n{code}\r\n2. Run the app in Android device.\r\n3. Click change button\r\n\r\nh6.Expect Result\r\nThe value of textfield is set, and cursor is in the end of text\r\n\r\nh6. Actual Result\r\nThe cursor will be in the beginning of text \r\n\r\nh6.Note\r\nOnly happens for Android, iOS working well.", "attachment": [], "flagged": false, "summary": "Android: Set textfield value by coding will make cursor to the beginning of textfield", "creator": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "subtasks": [], "reporter": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "environment": "Android 4.4.2 and 5.0+\r\nTISDK 5.2.2 and 5.3.0", "comment": { "comments": [ { "id": "400460", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "Just testing this on Android and I think the \\- is the problem. Since the keyboardType is set to TYPE_NUMBER_FLAG_DECIMAL a \\- is only allowed at the beginning of the TextField (https://developer.android.com/reference/android/text/InputType.html#TYPE_NUMBER_FLAG_SIGNED) since it changes the inputtype of the textfield.\r\n\r\nWhen you run the code you'll see that the fist 2 is missing and you'll get a index out of bounce error. If you remove the middle \"-\" the code runs fine and the cursor is at the end. \r\n\r\nSo it might be usefull to add a check for real decimal values in setValue when the keyboard is set to DECIMAL on Android\r\n\r\nSDK: 6.0.0.v20161104064744", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-11-06T14:03:08.000+0000", "updated": "2016-11-06T14:04:08.000+0000" }, { "id": "400462", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Thanks Michael, good catch! [~sliang] Can you apply those changes? Summarized, the problem is that you used non-decimal values in a text field that has a {{Ti.UI.KEYBOARD_DECIMAL_PAD}} and will therefore cause problems with the value. So either stick to a non-decimal keyboard or remove the {{-}}.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-11-06T14:23:10.000+0000", "updated": "2016-11-06T14:23:10.000+0000" }, { "id": "414395", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing this ticket as the issue is not our bug.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-21T20:51:31.000+0000", "updated": "2017-03-21T20:51:31.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }