You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Andre Schütz <wi...@faustas.de> on 2013/04/27 00:31:19 UTC

Ajax call of textfield after pressing the Enter key

Hello,

I tried to find out how I can make a Ajax call from a textfield after pressing the Enter key. I want to reach the following:
- The user types a name into the textfield
- After pressing the Enter key, the value of the textfield will be processed on the server side

I tried AjaxFormSubmitBehavior and AjaxFormComponentUpdatingBehavior without success.
Can anyone help me with an example?

-- 
Andre Schütz <wi...@faustas.de>

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


Re: Ajax call of textfield after pressing the Enter key

Posted by vineet semwal <vi...@gmail.com>.
hi,
just minor correction, enter key is 13 ..



On Sat, Apr 27, 2013 at 11:34 AM, Martin Grigorov <mg...@apache.org>wrote:

> Hi,
>
>
> On Sat, Apr 27, 2013 at 12:31 AM, Andre Schütz <wi...@faustas.de> wrote:
>
> > Hello,
> >
> > I tried to find out how I can make a Ajax call from a textfield after
> > pressing the Enter key. I want to reach the following:
> > - The user types a name into the textfield
> > - After pressing the Enter key, the value of the textfield will be
> > processed on the server side
> >
> > I tried AjaxFormSubmitBehavior and AjaxFormComponentUpdatingBehavior
> > without success.
> > Can anyone help me with an example?
> >
>
> Both behaviors will do the job.
> You should listen on "keypress" or "keyup" event and you should have a
> AjaxCallListener precondition that checks that the pressed key is Enter
> (Wicket.Event.keyCode(attrs.event) === 27)
>
>
> >
> > --
> > Andre Schütz <wi...@faustas.de>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Martin Grigorov
> Wicket Training & Consulting
> http://jWeekend.com <http://jweekend.com/>
>



-- 
regards,

Vineet Semwal

Re: Ajax call of textfield after pressing the Enter key

Posted by Martin Grigorov <mg...@apache.org>.
Hi,


On Sat, Apr 27, 2013 at 12:31 AM, Andre Schütz <wi...@faustas.de> wrote:

> Hello,
>
> I tried to find out how I can make a Ajax call from a textfield after
> pressing the Enter key. I want to reach the following:
> - The user types a name into the textfield
> - After pressing the Enter key, the value of the textfield will be
> processed on the server side
>
> I tried AjaxFormSubmitBehavior and AjaxFormComponentUpdatingBehavior
> without success.
> Can anyone help me with an example?
>

Both behaviors will do the job.
You should listen on "keypress" or "keyup" event and you should have a
AjaxCallListener precondition that checks that the pressed key is Enter
(Wicket.Event.keyCode(attrs.event) === 27)


>
> --
> Andre Schütz <wi...@faustas.de>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
Wicket Training & Consulting
http://jWeekend.com <http://jweekend.com/>