PDA

View Full Version : Problem with TextField.selectText in Chrome and Safari



Eric24
3 Jan 2011, 11:11 AM
In FF and IE, this works fine, but in Chrome and Safari, the text is quickly selected, then deselcted, although the field appears to retain focus. Bug in selectText?




listeners : {
'focus' : "::tn.fileWindow.onNameFieldFocus"
}


onNameFieldFocus : function(field) {
var win = tn.common.windowManager.getActive(), ext = win.$file.ext, value = field.getValue();
if (value.length > 0) {
if (ext.length == 0) field.selectText();
else if (value.length > ext.length) field.selectText(0, (value.length - ext.length) - 1);
}
},