{ "id": "81740", "key": "TIMOB-5810", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "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": [ { "id": "13870", "description": "", "name": "Sprint 2012-16 API", "archived": true, "released": true, "releaseDate": "2012-08-13" }, { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-07-30T18:14:20.000+0000", "created": "2011-10-19T11:22:18.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "api", "module_textarea", "parity", "qe-testadded" ], "versions": [ { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" } ], "issuelinks": [], "assignee": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-09-07T14:05:09.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": "TextField and TextArea needs a property to control the max length of the input text.\r\n\r\nThough this can be done using an eventlistener and a length check. It would be very useful if this was built-in.\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow();\r\n\r\nvar txt = Ti.UI.createTextField({\r\n top: 150,\r\n\theight: 100,\r\n backgroundColor: \"white\"\r\n});\r\n\r\n/* var txt = Ti.UI.createTextArea({\r\n top: 150,\r\n height: 100,\r\n backgroundColor: \"white\" */\r\n\r\nvar button = Ti.UI.createButton( {\r\n title: \"set max length to 10\"\r\n});\r\n\r\nbutton.addEventListener('click', function(e) {\r\n txt.maxLength = 10;\r\n});\r\nTi.API.info(\"maxLength: \" + txt.maxLength);\r\nwin.add(txt);\r\nwin.add(button);\r\nwin.open();\r\n{code}\r\n\r\n1. Run code\r\n2. Check log, make sure maxLength is -1\r\n3. Click on button\r\n4. Start typing, the content should not exceed 10 characters.\r\n5. Re-run code, this time enter 20+ characters before click on button\r\n6. Click on button, text now should truncate to 10 characters\r\n7. Repeat 1-6 on textArea.", "attachment": [], "flagged": false, "summary": "Android: maxLength propery on TextField and TextArea", "creator": { "name": "mofle", "key": "mofle", "displayName": "Sindre Sorhus", "active": true, "timeZone": "Europe/Oslo" }, "subtasks": [], "reporter": { "name": "mofle", "key": "mofle", "displayName": "Sindre Sorhus", "active": true, "timeZone": "Europe/Oslo" }, "environment": "TiSDK: 2.1GA", "comment": { "comments": [ { "id": "169885", "author": { "name": "kwhinnery", "key": "kwhinnery", "displayName": "Kevin Whinnery", "active": true, "timeZone": "America/Chicago" }, "body": "Feature request to limit the number of characters allowed in a text field.", "updateAuthor": { "name": "kwhinnery", "key": "kwhinnery", "displayName": "Kevin Whinnery", "active": true, "timeZone": "America/Chicago" }, "created": "2011-10-20T12:17:20.000+0000", "updated": "2011-10-20T12:17:20.000+0000" }, { "id": "214042", "author": { "name": "rumbrasas", "key": "rumbrasas", "displayName": "Rima Umbrasas", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed with \r\nmobile sdk-2.2.0.v20120810080115\r\nTitanium Studio, build: 2.1.1.201207271312\r\nDevice:\r\nGalaxy S III Android version 4.0.4\r\n", "updateAuthor": { "name": "rumbrasas", "key": "rumbrasas", "displayName": "Rima Umbrasas", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-08-13T10:13:43.000+0000", "updated": "2012-08-13T10:13:43.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }