PDA

View Full Version : [FIXED-1022] Ext Bug in Textfield focus



zbeckerman
19 Feb 2010, 11:24 AM
Ext 2.3.0

There is a small bug in Textfield. Steps to reproduce are as follows:

1. Create 2 text fields. Set each to have emptyText.
2. Place mouse in first Textfield.
2a. As expected, empty text is removed and cursor appears in Textfield box.
3. Using Tab key only, tab to the next field.
2a. As expected, empty text is removed. However, cursor does not appear even though the textfield has focus.

Expected: That the cursor should be placed in the second textbox when user tabbed into it.
Observed: The field was selected, emptytext removed, but no cursor appears.

------------------------------------------
Code Fix (in red). I have added el.dom.select AFTER the raw value is set to "". Now the code beneath uses a defer method as well. Please review my change and fix it if appropiate to use defer method.
Thanks!




// private

preFocus :

function(){


var el = this.el;


if(this.emptyText){

if(el.dom.value == this.emptyText){

this.setRawValue('');
el.dom.select();
}
el.removeClass(








this.emptyClass);


}


if(this.selectOnFocus){

(function(){

el.dom.select();
}).defer(this.inEditor && Ext.isIE ? 50 : 0);
}







},

jsakalos
19 Feb 2010, 12:52 PM
Do you want me to move this bug fix to Bugs forum?

zbeckerman
20 Feb 2010, 5:40 PM
Sure.
Thanks!

evant
21 Feb 2010, 6:11 AM
I wasn't able to reproduce this, either using 3.x or 2.x.

Can you provide more info?

zbeckerman
2 Jun 2010, 1:06 PM
Here is the code snippet to test this, still broken in 3.2.1


<html>
<head>
<link rel="stylesheet"
href="../resources/css/ext-all.css"
type="text/css">
<script language="JavaScript"
src="../adapter/ext/ext-base.js"></script>
<script language="JavaScript" src="../ext-all.js"></script>
</head>
<body>
<div id="dr"></div>
<script>
Ext.onReady(function(){

Ext.QuickTips.init();




var dr = new Ext.FormPanel({
labelWidth: 125,
frame: true,
title: 'Date Range',
bodyStyle:'padding:5px 5px 0',
width: 350,
defaults: {width: 175},
defaultType: 'datefield',
items: [{
fieldLabel: 'Start Date',
name: 'startdt',
id: 'startdt',
emptyText: 'hh:mm'

},{
fieldLabel: 'End Date',
name: 'enddt',
id: 'enddt',
emptyText: 'hh:mm'
}]
});

dr.render('dr');

});
</script>
</body>
</html>

evant
8 Jun 2010, 1:15 AM
This has been corrected for 3.3.x.