Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19164] iOS: textfield getValue() returns the misspelled text under iOS8

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionCannot Reproduce
Resolution Date2015-09-14T04:29:04.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labels3.4.0, 3.4.1, TCSupportTriage, autocorrect, ios8, iphone, textfield
ReporterMarkus Eschenbach
AssigneeHans Knöchel
Created2014-11-10T08:54:14.000+0000
Updated2017-03-21T22:10:21.000+0000

Description

Problem description

The textfield function "getValue()" returns the wrong (old) value, if the autocorrection replace the misspelled word.

Steps to reproduce

1. Click into the textfield 2. Enter a misspelled word like "asdjflkjsd" 3. Click into the textfield as soon as the autocorrection appears 4. Click the button to alert the wrong misspelled textfield value again

Test case

(function() {

	var win = Ti.UI.createWindow({backgroundColor:'#ffffff'});

	var view = Ti.UI.createView({layout:'vertical'});
	
	var button = Ti.UI.createButton({title:' Read textfield value ',top:20,borderRadius:5,borderColor:'#1C1C1C',backgroundColor:'#C0C0C0'});
	
	var textfield = Ti.UI.createTextField({
		borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
		autocapitalization: Titanium.UI.TEXT_AUTOCAPITALIZATION_NONE,
        top: 70,
        height: 30,
        width:Titanium.UI.FILL
   });
	
   var label = Ti.UI.createLabel({left:20,top:20,width:Titanium.UI.FILL,font:{fontSize:12},
   text:'PROBLEM DESCRIPTION\n'
   +'The textfield function "getValue()" returns the wrong (old)value, if the autocorrection replace the misspelled word\n\n'
   +'STEPT TO REPRODUCE\n'
   +'1. Click into the textfield\n'
   +'2. Enter a misspelled word like "asdjflkjsd"\n'
   +'3. Click into the textfield as soon as the autocorrection appears\n'
   +'4. Click the button to alert the wrong misspelled textfield value again.\n\n'
   +'ENVIRONMENT\n'
   +'Ti Mobile SDK: 3.4.0 GA, Ti Studio: 3.4.0.201409261227, iOS: 8.1 & 8.1.1, Device: iPhone 5 and 5S'});	
	
	button.addEventListener('click',function(e){
		alert(textfield.getValue());
	});
	
	textfield.addEventListener('click',function(e){
		if(textfield.getValue() !== ''){
			alert(textfield.getValue());
		}
	});
	
	view.add(textfield);
	view.add(button);
	view.add(label);
	win.add(view);

  	win.open();
})();

Comments

  1. Hans Knöchel 2015-09-02

    [~ahossain], [~rtlechuga]: I've tested the issue using the latest 5.0 master and cannot reproduce a misspelled text. There is no autocorrection (and provide the property autocorrect). Please recheck the issue and if reproducible, attach some screens. Thank you guys! EDIT: Tested on both 8.X and 9.0
  2. Lee Morris 2017-03-21

    Closing ticket as the issue cannot be reproduced and due to the above comments.

JSON Source