Re: Handling OnKeyPress event

2010-12-29 Thread Tejash Tarun
Hi,

I guess if we add
 AjaxFormComponentUpdatingBehavior() to the component then
we can get the string from the model
and then we can extract the (last) character keyed-in.
This should work for normal characters.

Regards,
Tejash

On Wed, Dec 29, 2010 at 1:05 PM, Josh Kamau joshnet2...@gmail.com wrote:

 Hi Team;

 Is there a way of handling onKey.. events in wicket, where by i will know
 which key was pressed. I specifically want to do some ajax update when
 Return key is pressed.

 Kind regards.
 Josh.



Re: Handling OnKeyPress event

2010-12-29 Thread Martin Grigorov
Hi Josh,

This is pure JavaScript task. You need something like : onkeypress=if
(event.keyCode !== 13) return; doSomething();. I.e. fast return if the key
is not ENTER, otherwise do what you need to do.

If you need this for Ajax component/behavior then see its
getAjaxCallDecorator() method.

See also Wicket's helper JS
functions: wicketKeyCode(Wicket.fixEvent(event)).

On Wed, Dec 29, 2010 at 8:35 AM, Josh Kamau joshnet2...@gmail.com wrote:

 Hi Team;

 Is there a way of handling onKey.. events in wicket, where by i will know
 which key was pressed. I specifically want to do some ajax update when
 Return key is pressed.

 Kind regards.
 Josh.



Re: Handling OnKeyPress event

2010-12-29 Thread Bas Gooren

Hi Josh,

Have a look at 
http://databinder.net/javadoc/net/databinder/components/AjaxOnKeyPausedUpdater.html
It's a Java + Javascript ready-to-run component, of which the source is 
available.


Bas

- Original Message - 
From: Martin Grigorov mgrigo...@apache.org

To: users@wicket.apache.org
Sent: Wednesday, December 29, 2010 9:40 AM
Subject: Re: Handling OnKeyPress event



Hi Josh,

This is pure JavaScript task. You need something like : onkeypress=if
(event.keyCode !== 13) return; doSomething();. I.e. fast return if the 
key

is not ENTER, otherwise do what you need to do.

If you need this for Ajax component/behavior then see its
getAjaxCallDecorator() method.

See also Wicket's helper JS
functions: wicketKeyCode(Wicket.fixEvent(event)).

On Wed, Dec 29, 2010 at 8:35 AM, Josh Kamau joshnet2...@gmail.com wrote:


Hi Team;

Is there a way of handling onKey.. events in wicket, where by i will know
which key was pressed. I specifically want to do some ajax update when
Return key is pressed.

Kind regards.
Josh.






-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Handling OnKeyPress event

2010-12-28 Thread Josh Kamau
Hi Team;

Is there a way of handling onKey.. events in wicket, where by i will know
which key was pressed. I specifically want to do some ajax update when
Return key is pressed.

Kind regards.
Josh.