[TIMOB-2896] iOS: Calling textField.blur() not working
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Trivial |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2011-11-05T14:41:37.000+0000 |
| Affected Version/s | Release 1.6.0 |
| Fix Version/s | Sprint 2011-34, Release 1.8.0 |
| Components | iOS |
| Labels | n/a |
| Reporter | Pedro Enrique |
| Assignee | Reggie Seagraves |
| Created | 2011-04-15T03:32:21.000+0000 |
| Updated | 2011-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
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
Call windowWillOpen, windowDidOpen when adding proxies to the toolbar. Pull request pending.
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.
Replace the sample script: tf.blur(); with textfield.blur();
Tested, reviewed, merged, signed, sealed, delivered.
Passed as expected on iPhone 4 running 4.2.10 and iPad 2 running 4.3.2.
Standardizing summary and labels.