Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17210] Android: TextField/TextArea "change" event should not trigger when setting "value" or "attributedString" properties

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2018-02-13T15:39:48.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.1.0
ComponentsAndroid
Labelsandroid, listener, textarea, textfield
Reportercarlo
AssigneeMaggie Chen
Created2014-06-24T08:13:15.000+0000
Updated2018-03-05T23:58:15.000+0000

Description

Try the code below. A textfield change listener is wrongly triggered also if the value is programmatically set before the creation. This happen only on Android, and only if the change event listener is created after the ui thread.
var w = Ti.UI.createWindow({
	layout:'vertical',
	backgroundColor:'white'	
});


var input = Ti.UI.createTextField({
	width:"100%",
	value:'default',
	top:100
});

input.value = 'pre UI value';
input.addEventListener('change', function(e){
	alert('this is alert is shown only on user input');
});

var button = Ti.UI.createButton({
	title:"Set a new value and then add change listener"
});
button.addEventListener('click', function(){
	input.value = 'new value';
	input.addEventListener('change', function(e){
		alert('this is alert is shown on android');
	});
});

w.add(input);
w.add(button);
w.open();

Comments

  1. Shuo Liang 2014-06-25

    Hi, Thank you for your ticket. I will forward this ticket to our engineer team. Regards, Shuo Liang
  2. Shuo Liang 2014-06-25

    Tested with this code, when we change the textfield value programmatically, like above code: {quote}input.value = 'new value';{quote}. For android device, it will trigger change event, but for IOS device, it will not trigger change event.
  3. Marian Kucharcik 2017-11-07

    Hi guys, any news on this? This bug causes a lot of trouble for me(tested with 6.3.0GA, on Android 7.1 Nexus 5X device and still present). Thanks
  4. Marian Kucharcik 2017-11-22

    Hi guys, can you please fix it and implement to 7.0GA SDK release? Thanks
  5. Marian Kucharcik 2017-12-28

    Hello guys, any news on this? I need this fixed to finish and release app. Thanks
  6. Clément Blanco 2018-01-08

    Same here. +1
  7. Marian Kucharcik 2018-01-08

    Hi Clément, did you find any workaround? I'm hopeless, that this bug is reported 3years ago and still not resolved and no one from Appc reacted to my requests... I have textfield and when I enter some value, tableview shows up with autocomplete suggestion. I click on tableview's row and it writes new value to textfield. Problem is, that when I click on tableview, it appears again and again(because of this bug). Thanks
  8. Maggie Chen 2018-01-08

    PR https://github.com/appcelerator/titanium_mobile/pull/9700
  9. Marian Kucharcik 2018-01-16

    Hi Maggie, how it is looking with review? When we can expect integration into SDK? Thanks
  10. Marian Kucharcik 2018-02-09

    Hi guys, any news on this fix? I'm still waiting for this to be fixed, status says, that it's in review for 1 month and no information provided since then. Please post some new info when we can expect fix for this bug. Thanks
  11. Marian Kucharcik 2018-02-13

    @Joshua Quick Hi Joshua, when we can expect release 7.1.0? Thanks
  12. Joshua Quick 2018-02-15

    PR (7.1.x): https://github.com/appcelerator/titanium_mobile/pull/9834
  13. Lokesh Choudhary 2018-03-05

    Verified the fix in SDK 7.2.0.v20180302144729 & 7.1.0.v20180302141418. Closing. Studio Ver: 5.0.0.201712081732 OS Ver: 10.13.2 Xcode Ver: Xcode 9.2 Appc NPM: 4.2.12 Appc CLI: 7.0.2 Daemon Ver: 1.0.1 Ti CLI Ver: 5.0.14 Alloy Ver: 1.11.0 Node Ver: 8.9.1 NPM Ver: 5.5.1 Java Ver: 1.8.0_101 Devices: ⇨ google Nexus 5 --- Android 6.0.1 ⇨ google Nexus 6P --- Android 8.0.0

JSON Source