-
Sencha User
How to put keybord event to formPanel?
Hi,
I want to know how it's possible to submit a form with the key "enter".
I use a formPanel, I have test:
myformPanel.on("keypress",function(e){
alert("event"+e.getKey());
});
and
myformPanel.addListener("onkeypress",function(e){
alert("event"+e.getKey());
});
but it's don't work, I don't have an alert.
Thanks
Jim
-
The first one (without the 'on') is correct.
But it doesn't work, because the element inside the form 'steal' the enter key.
Fortunately there is a better solution.
-
Sencha User
Thanks it's just what I want but I don't know how to implement this because I use panelForm and not BasicForm.
Do you have an example who implement this please.
Thanks
Jim
-
If you don't have a <form> tag you're stuck with adding a keydown handler to every field on the panel.
-
Sencha User
If I understand I have to change my formPanel to a basicForm?
If I don't have another choice ^^ . Do you have an example with basicForm with submit on enter?
Thanks
Jim
-
A FormPanel contains a BasicForm (see the API docs for FormPanel.getForm) and it is created with the same config options (except listeners).
So Animals override also adds for a submitOnEnter config option in FormPanel.
-
Sencha User
I have try to put "submitOnEnter:true," in parameter of my formPanel and firebug give me
Ext.isObject is not a function
[IMG]chrome://firebug/content/blank.gif[/IMG] this.submit(Ext.isOb...er) ? this.submitOnEnter : undefined);\r\n
I use ExtJS on mapfish not ExtJS 3.0, it's a problem?
Thanks for help
Jim
-
It's an Ext 3.0 override. You would need to modify it for Ext 2.x.
-
Sencha User
I try to adapt the overide of animal but I don't understand this line:
this.submit(Ext.isObject(this.submitOnEnter) ? this.submitOnEnter : undefined);
Where I can find the ExtJS 2.x API documentation? Because Ext.isObject doesn't exist.
I have test this:
this.submit(true ? this.submitOnEnter : undefined);
but it's don't work 
Thanks for help
Jim
-
31 Aug 2009, 10:03 AM
#10
Change:
Ext.isObject(this.submitOnEnter)
to
typeof this.submitOnEnter == 'object'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules