Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10221] MobileWeb: Implement maxLength for TextArea

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-08-13T17:05:43.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sSprint 2012-16 API, Release 3.0.0
ComponentsMobileWeb
Labelsapi, parity, qe-port
ReporterHieu Pham
AssigneeBryan Hughes
Created2012-07-27T15:22:27.000+0000
Updated2012-10-16T22:00:11.000+0000

Description

1. Run this code
var win = Ti.UI.createWindow();

 
var txt = Ti.UI.createTextArea({
    top: 150,
    height: 100,
    backgroundColor: "white" 
});
 
var button = Ti.UI.createButton( {
    title: "set max length to 10"
});
 
button.addEventListener('click', function(e) {
   txt.maxLength = 10;
});
Ti.API.info("maxLength: " + txt.maxLength);
win.add(txt);
win.add(button);
win.open();
2. Check log, make sure maxLength is -1 3. Click on button 4. Start typing, the content should not exceed 10 characters. 5. Re-run code, this time enter 20+ characters before click on button

Comments

  1. Bryan Hughes 2012-08-07

    Pull Request: https://github.com/appcelerator/titanium_mobile/pull/2692
  2. Lokesh Choudhary 2012-08-13

    'Max length' does not work on chrome 18.0 & firefox in android 14.0.1.It works on the default android browser. Tapping on the button for max length does nothing,we can still type text more than the count of 10. It works fine on desktop browsers & iphone. Tested on: Titanium studio : 2.1.1.201207271312 SDK version : 2.2.0.v20120810194112 Android 4.0.4 - default ,chrome 18.0 , firefox 14.0.1 Iphone 4.3.5 - safari mobile Mountain lion(10.8) - chrome 21.0,safari 6,firefox 14.0.1
  3. Bryan Hughes 2012-08-13

    Those browser's must not support the "maxlength" css property then. We have a different ticket setup for shimming it in browser's that don't natively support it.
  4. Tamila Smolich 2012-10-16

    Verified feature works as expected. Tested on: Titanium Studio, build: 3.0.0.201210151149 Titanium SDK, build: 3.0.0.v20121015174610 Android 4.1.1 - Chrome 18.0, FireFox 15.0.1 iPhone 4S (4.3.5) - Safari mobile Lion 10.7.4 - Google Chrome 22.0, Safari 5.1.6

JSON Source