Trigger button when pressing enter in text control

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Trigger button when pressing enter in text control

Stian Sigvartsen
Trigger button when pressing enter in text control

Hi

Can anyone provide guidance on how to implement behaviour so that if the user is entering text in a text control and then presses enter on the keyboard, this triggers a specific button on the form?

Basically I'm building a simple search engine form which allows entry of a value and then the user can search and results are shown below (still within the XForm). User's find having to use the mouse to press the "search" button or tabbing to it a hassle.

-Stian



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Trigger button when pressing enter in text control

Erik Bruchez
Administrator
"Enter" in an input field dispatches the DOMActivate event. So you can
listen to that.

<xf:input ...>
  <xf:action ev:event="DOMActivate">
   ...

If you want to delegate to another button, you could do:

<xf:input ...>
  <xf:dispatch ev:event="DOMActivate" name="DOMActivate"
targetid="my-button-id"/>
</xf:input>

You could also use a single event handler which listens to the input
as well as the trigger.

-Erik

On Tue, Nov 27, 2012 at 6:40 AM, Stian Sigvartsen
<[hidden email]> wrote:

> Hi
>
> Can anyone provide guidance on how to implement behaviour so that if the
> user is entering text in a text control and then presses enter on the
> keyboard, this triggers a specific button on the form?
>
> Basically I'm building a simple search engine form which allows entry of a
> value and then the user can search and results are shown below (still within
> the XForm). User's find having to use the mouse to press the "search" button
> or tabbing to it a hassle.
>
> -Stian
>
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing
> list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Re: Trigger button when pressing enter in text control

Stian Sigvartsen
In reply to this post by Stian Sigvartsen
Thanks Erik. I feel I should have known the answer to my question.
I think I got too stuck in the basic html forms mindset for a moment to piece this together!

-Erik


-----Original Message-----
From: Erik Bruchez [mailto:[hidden email]]
Sent: Fri 11/30/2012 06:18
To: [hidden email]
Subject: [ops-users] Re: Trigger button when pressing enter in text control
 
"Enter" in an input field dispatches the DOMActivate event. So you can
listen to that.

<xf:input ...>
  <xf:action ev:event="DOMActivate">
   ...

If you want to delegate to another button, you could do:

<xf:input ...>
  <xf:dispatch ev:event="DOMActivate" name="DOMActivate"
targetid="my-button-id"/>
</xf:input>

You could also use a single event handler which listens to the input
as well as the trigger.

-Erik

On Tue, Nov 27, 2012 at 6:40 AM, Stian Sigvartsen
<[hidden email]> wrote:

> Hi
>
> Can anyone provide guidance on how to implement behaviour so that if the
> user is entering text in a text control and then presses enter on the
> keyboard, this triggers a specific button on the form?
>
> Basically I'm building a simple search engine form which allows entry of a
> value and then the user can search and results are shown below (still within
> the XForm). User's find having to use the mouse to press the "search" button
> or tabbing to it a hassle.
>
> -Stian
>
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing
> list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

winmail.dat (4K) Download Attachment