Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8041] MobileWeb : TextField - The maxLength property of textField is not being enforced

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2012-03-21T22:11:53.000+0000
Affected Version/sRelease 2.0.0
Fix Version/sRelease 2.0.0, Sprint 2012-06
ComponentsMobileWeb
Labelsqe-mw020912, qe-port
ReporterMichael Pettiford
AssigneeChris Barber
Created2012-03-15T13:32:30.000+0000
Updated2012-08-08T16:27:57.000+0000

Description

Steps to reproduce: 1. Create a default mobile web app and change the app.js code to the following:

var _window = Titanium.UI.createWindow({
			title : 'test',
			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
		});
		_window.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);
		});
		_window.add(b);

		var b2 = Ti.UI.createButton({
			title : 'Unlimited length',
			width : 200,
			height : 40,
			bottom : 120
		});
		b2.addEventListener('click', function(e) {
			tf.maxLength = -1;
		});
		_window.add(b2);
_window.open();
2. Run app 3. Type 15 more characters into the text field Actual result: Text field displays 21 characters Expected result: Text field stops at the 20th character

Comments

  1. Chris Barber 2012-03-21

    Pull request: https://github.com/appcelerator/titanium_mobile/pull/1788
  2. Chris Barber 2012-03-21

    Closing for Bryan.
  3. Lokesh Choudhary 2012-08-08

    Tested On: Titanium studio : 2.1.1.201207271312 SDK version : 2.2.0.v20120807144112 Android 4.0.4 - default ,chrome 18.0 Iphone 4.3.5 - safari mobile Mountain lion(10.8) - chrome 21.0,safari 5.1.4,firefox 14.0.1

JSON Source