Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6000] Android: replacing the textfield value makes the cursor go back to the start

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionWon't Fix
Resolution Date2011-11-04T19:45:12.000+0000
Affected Version/sRelease 1.7.5, Release 1.8.0
Fix Version/sn/a
ComponentsAndroid
Labelscursor, position, textfield
ReporterKarol Pomaski
AssigneeMarshall Culpepper
Created2011-11-04T14:19:17.000+0000
Updated2011-11-04T19:45:12.000+0000

Description

Problem

Replacing the textfield value makes the cursor go back before the first character. Works correctly on iOS.

Reproducible Steps

1. Run the Sample Code 2. Put one character into the textfield

Sample Code

// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');


var win1 = Titanium.UI.createWindow({  
    title:'Tab 1',
    backgroundColor:'#fff'
});


var label1 = Titanium.UI.createLabel({
	color:'#999',
	text:'I am Window 1',
	font:{fontSize:20,fontFamily:'Helvetica Neue'},
	textAlign:'center',
	width:'auto'
});

var textfield = Titanium.UI.createTextField({
    color:'#336699',
    value:'',
    height:35,
    width:300,
    top:10,
    borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
    keyboardToolbarColor: '#999',   
    keyboardToolbarHeight: 40,
    autocapitalization: Titanium.UI.TEXT_AUTOCAPITALIZATION_NONE,
    autocorrection: false
   
});

win1.add(textfield);
textfield.addEventListener("change",function(e){
	if(textfield.value.length>0) textfield.value = "test";
});

win1.open();

Associated HelpDesk Ticket

http://appc.me/c/APP-436254

Comments

  1. Don Thorp 2011-11-04

    The required solution is much bigger than expressed in this ticket and its test case. TIMOB-6006 was created to expose the appropriate APIs to allow this to be solved by the application developer.

JSON Source