Checkout the wicket input events project..:

http://wicketstuff.org/confluence/display/STUFFWIKI/wicket-stuff-contrib-input-events

vishy_sb wrote:
I have a form inside a modal window. The form has a textfield field and a
button in it. I want to set the focus on the button when I enter something
in the textfield. I tried adding the following behaviour to the textfield
but it is not working.
textfield.add(new AbstractBehavior(){

                        private static final long serialVersionUID = 1L;
@Override
                public void onComponentTag(Component component, ComponentTag 
tag) {
                        tag.put("onkeydown",
"if(event.keyCode==13){searchButton.click();return false;}");
                }
});
Also can someone suggest a way to hook up the button in the form with the
Enter key on the keyboard so that whenever I input something in the
textfield and hit the enter key the onClick() or onSubmit() event of the
button gets fired???
Any help will be greatly appreciated.

Thanks,
vishy

--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to