You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by vishy_sb <sh...@gmail.com> on 2008/11/13 20:41:05 UTC
Setting a button press on hitting the enter key from the keyboard
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
--
View this message in context: http://www.nabble.com/Setting-a-button-press-on-hitting-the-enter-key-from-the-keyboard-tp20488048p20488048.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Setting a button press on hitting the enter key from the
keyboard
Posted by vishy_sb <sh...@gmail.com>.
Thanks for the reply Nino.
I was able to get it to work using the thread at
http://www.nabble.com/IE7-ignores-AjaxButton-onSubmit-when-I-use-the-keyboard-enter-key-td20234862.html#a20236544
Thanks for the help though,
vishy
Nino.Martinez wrote:
>
> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Setting-a-button-press-on-hitting-the-enter-key-from-the-keyboard-tp20488048p20489286.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Setting a button press on hitting the enter key from the keyboard
Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org