Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2896] iOS: Calling textField.blur() not working

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionFixed
Resolution Date2011-11-05T14:41:37.000+0000
Affected Version/sRelease 1.6.0
Fix Version/sSprint 2011-34, Release 1.8.0
ComponentsiOS
Labelsn/a
ReporterPedro Enrique
AssigneeReggie Seagraves
Created2011-04-15T03:32:21.000+0000
Updated2011-11-05T14:41:37.000+0000

Description

This is a simple example of two textFields, one on the toolbar and another one on the window itself.
Two buttons that will make them blur, but not working.
Example:
http://pastie.org/1479732">http://pastie.org/1479732

Bug found while to debugging HD ticket: http://developer.appcelerator.com/helpdesk/view/66241">http://developer.appcelerator.com/helpdesk/view/66241

Tested on iPhone and iPad simulator running iOS 4.2 and Ti. SDK 1.4.3, 1.5.1, 1.5.2, and 1.6.0

Comments

  1. Francisco Antonio Duran Ramirez 2011-08-19

    Problem:

    Keyboard does not disappear when the customer use the textfield.blur()

    Reproducible steps:

    Run the code below.

    Expected Behavior:

    Disappear the keyboard when user use textfield.blur()

    Sample Code:

       var win = Titanium.UI.createWindow();
       
       win.orientationModes = [
       	Titanium.UI.PORTRAIT,
       	Titanium.UI.UPSIDE_PORTRAIT,
       	Titanium.UI.LANDSCAPE_LEFT,
       	Titanium.UI.LANDSCAPE_RIGHT
       ]; 
       
       var flexSpace = Titanium.UI.createButton({
       	systemButton:Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE
       });
       
       var tf = Titanium.UI.createTextField({
       	height:32,
       	//backgroundImage:'../images/inputfield.png',
       	backgroundColor:'white',
       	width:200,
       	font:{fontSize:13},
       	color:'#777',
       	paddingLeft:10,
       	borderStyle:Titanium.UI.INPUT_BORDERSTYLE_NONE
       });
       
       var camera = Titanium.UI.createButton({
       	backgroundImage:'../images/camera.png',
       	height:33,
       	width:33
       });
       camera.addEventListener('click', function()
       {
       	Titanium.UI.createAlertDialog({title:'Toolbar',message:'You clicked camera!'}).show();
       });
       
       var send = Titanium.UI.createButton({
       	backgroundImage:'../images/send.png',
       	backgroundColor:'orange',
       	title:'Send',
       	backgroundSelectedImage:'../images/send_selected.png',
       	width:67,
       	height:32
       });
       send.addEventListener('click', function()
       {
       	tf.blur();
       	Titanium.UI.createAlertDialog({title:'Toolbar',message:'You clicked send!'}).show();
       });
       
       
       var textfield = Titanium.UI.createTextField({
       	color:'#336699',
       	value:'Focus to see keyboard w/ toolbar',
       	height:35,
       	width:300,
       	top:10,
       	borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
       	keyboardToolbar:[flexSpace,camera, flexSpace,tf,flexSpace, send,flexSpace],
       	keyboardToolbarColor: '#999',	
       	keyboardToolbarHeight: 40
       });
       
       var textfield2 = Titanium.UI.createTextField({
       	color:'#336699',
       	value:'Focus to see keyboard w/o toolbar',
       	height:35,
       	width:300,
       	top:70,
       	borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
       });
       
       
       
       win.add(textfield);
       win.add(textfield2);
       win.open();
       
       

    Helpdesk APP-814256

  2. Reggie Seagraves 2011-08-22

    Call windowWillOpen, windowDidOpen when adding proxies to the toolbar. Pull request pending.
  3. Reggie Seagraves 2011-08-22

    Note that the sample script has an error with regard to the second event handler blurring the wrong text field (textField1) and should be blurring textField2.
  4. Natalie Huynh 2011-08-25

    Replace the sample script: tf.blur(); with textfield.blur();
  5. Blain Hamon 2011-08-26

    Tested, reviewed, merged, signed, sealed, delivered.
  6. Alan Vaghti 2011-09-07

    Passed as expected on iPhone 4 running 4.2.10 and iPad 2 running 4.3.2.
  7. Don Thorp 2011-11-05

    Standardizing summary and labels.

JSON Source