PDA

View Full Version : how to use enter key to focusing next field in FormPanel



aimer311
20 Dec 2010, 7:22 PM
I change enter to tab key using

event.keyCode=9;
as we know it only effective in ie.How can I do this for firefox.
following is my source code


uft.extend.form.FormPanel.superclass.constructor.call(this,{
keys:[{
key:Ext.EventObject.ENTER,fn:this.enter2Tab
,scope:this
}]
});

enter2Tab:function(keyCode,e){
try{
if (Ext.isGecko){//firefox
// I don'n know how to do here
//e.keyCode=9;
//this.fireEvent('specialkey',e);

// var Event = document.createEvent("KeyEvents");
// Event.initKeyEvent("keydown",0,0,null,0,0,0,0,0,9);
// e.target.dispatchEvent(Event);
// e.preventDefault();
}else if(Ext.isIE){
window.event.keyCode=9;
}else{
e.keyCode=9;
e.browseEvent.keyCode=9;
}
}catch(E){}
},

any suggestion will be appreciated
thanks?

aimer311
21 Dec 2010, 8:26 AM
who can help me?

Animal
21 Dec 2010, 1:23 PM
Don't do it.

It's the wrong thing to do.

Train the users.

aimer311
21 Dec 2010, 6:41 PM
thanks for reply.
customers are hard to change their usage,and I still don't know why it's a wrong thing?
as It work fine in IE.
could you give me more info.

I found a solution from here http://www.sencha.com/forum/showthread.php?11619-Form-focusing-via-Enter-key,
but I have to change a lot for this.that is why I didn't do that yesterday.
thanks

Animal
21 Dec 2010, 11:22 PM
Nothing works like that any more. You'd just be swimming against the tide, creating false expectations and storing up trouble.