Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-17210

Android: TextField/TextArea "change" event should not trigger when setting "value" or "attributedString" properties

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Release 7.1.0
    • Component/s: Android
    • Environment:

      Titanium SDK 3.2.1, Titanium Studio 3.2.3, Mac OSX 10.9.3 / Windows 7
      Device: Android 4.2.2, Android 4.4.4

    • Story Points:
      1
    • Sprint:
      2018 Sprint 04 SDK

      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();
      

        Attachments

          Activity

            People

            • Assignee:
              mchen Maggie Chen
              Reporter:
              c3k carlo
              Reviewer:
              Joshua Quick
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-18890
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code