Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5309] iOS: TextField maxLength Property

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2011-09-20T10:15:47.000+0000
Affected Version/sRelease 1.8.0
Fix Version/sSprint 2011-37, Release 1.8.0
ComponentsiOS
Labelsbranch-5062, module_textfield, qe-testadded
ReporterDawson Toth
AssigneeStephen Tramer
Created2011-09-20T03:22:18.000+0000
Updated2014-06-19T12:46:43.000+0000

Description

Feature

Add a new "maxLength" property to text fields.

Example Usage

Ask me if one is needed, and I will gladly provide it.

Comments

  1. Stephen Tramer 2011-09-20

    Example code:
       var win = Ti.UI.createWindow({
       	backgroundColor:'white'
       });
       
       var tf = Ti.UI.createTextField({
       	value:'SAMPLE',
       	maxLength:20,
       	top:20,
       	left:20,
       	width:300,
       	height:60,
       	borderStyle:Ti.UI.INPUT_BORDERSTYLE_ROUNDED
       });
       win.add(tf);
       
       var b = Ti.UI.createButton({
       	title:'Increase maxLength',
       	width:200,
       	height:40,
       	bottom:60
       });
       b.addEventListener('click', function(e) {
       	tf.maxLength += 5;
       	Ti.API.info('maxLength: '+tf.maxLength);
       });
       win.add(b);
       
       var b2 = Ti.UI.createButton({
       	title:'Unlimited length',
       	width:200,
       	height:40,
       	bottom:120
       });
       b2.addEventListener('click', function(e) {
       	tf.maxLength = -1;
       });
       win.add(b2);
       
       win.open();
       
  2. Natalie Huynh 2012-02-08

    Tested with 1.9.0.v20120207171634 on iPad 2(5.0.1)

JSON Source