Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14241] Android: TextArea.maxLength doesn't work

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-03-27T15:19:42.000+0000
Affected Version/sn/a
Fix Version/sRelease 4.0.0
ComponentsAndroid
Labelsandroid, maxlength, parity
ReporterDjamel ZAHAL
AssigneeAshraf Abu
Created2013-06-14T10:00:35.000+0000
Updated2015-03-27T17:57:01.000+0000

Description

*Problem* TextArea.maxLength not working in android, works perfectly fine on iOS *Steps to Reproduce* 1. run code provided on iOS (notice the maxLength is working, limits characters to 20) 2. run code provided on android (unlimited characters can be entered)
var win = Ti.UI.createWindow({
   title : "Test",
   backgroundColor : 'gray'
});
 
var view = Ti.UI.createView({
    height : 200,
    top : 5,
    left : 5,
    right : 5,
    layout : 'vertical'
});
var textFieldTwitter = Ti.UI.createTextArea({
    left : 0,
    right : 0,
    height : 200,
    value : "Testing1",
    maxLength : 20
});
 
var tweetMax = 140;
var viewTexteRestant = Ti.UI.createLabel({
    text : 'Caractères restants : ' + (tweetMax - textFieldTwitter.value.length),
    height : Ti.UI.SIZE,
    width : Ti.UI.SIZE,
    top : 20,
    backgroundColor : "red"
});
 
textFieldTwitter.addEventListener('change', function(e) {
    Ti.API.info(tweetMax - textFieldTwitter.value.length);
    viewTexteRestant.text = 'Caractères restants : ' + (tweetMax - textFieldTwitter.value.length);
});
 
view.add(textFieldTwitter);
view.add(viewTexteRestant); 

win.open();
win.add(view); 
see : http://developer.appcelerator.com/question/153431/maxlength-in-textarea-doesnt-work

Comments

  1. Ashraf Abu 2015-03-27

    Took a look at this. 3.5.1.GA maxLength doesn't work. 4_0_X (4.0.0.v20150325201813) and Master branch works.
  2. Ingo Muschenetz 2015-03-27

    Marking this resolved in 4.0
  3. Lokesh Choudhary 2015-03-27

    Verified the issue is not seen in 4.0. The max characters entered are limited to 20 when the above code is ran. Closing. Environment: Appc Studio : 4.0.0.201503261211 Ti SDK : 4.0.0.v20150327082616 CLI : 4.0.0-alpha Alloy : 1.6.0-alpha MAC Yosemite : 10.10.2 Nexus 5 - Android 5.1 Samsung Galaxy S4 - Android 4.4.2

JSON Source