You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by fea jabi <zy...@hotmail.com> on 2006/10/26 23:01:05 UTC

disable enter key functionality

Is it possible in struts to disable the functionality of the enter key which 
would usually execute the first submit button in the page. Can we do this at 
form level?

If so how to do this?

Thanks.

_________________________________________________________________
Add a Yahoo! contact to Windows Live Messenger for a chance to win a free 
trip! 
http://www.imagine-windowslive.com/minisites/yahoo/default.aspx?locale=en-us&hmtagline


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: disable enter key functionality

Posted by Richard Yee <ry...@cruzio.com>.
Fea,
You need to add this javascript function to your form jsp files (or 
template)

  function noenter() {
    return !(window.event && window.event.keyCode == 13); }

and then add an onkeypress attribute to your text input fields that 
looks like this:

onkeypress="return noenter();"

-R


fea jabi wrote:
> Is it possible in struts to disable the functionality of the enter key 
> which would usually execute the first submit button in the page. Can 
> we do this at form level?
>
> If so how to do this?
>
> Thanks.
>
> _________________________________________________________________
> Add a Yahoo! contact to Windows Live Messenger for a chance to win a 
> free trip! 
> http://www.imagine-windowslive.com/minisites/yahoo/default.aspx?locale=en-us&hmtagline 
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: disable enter key functionality

Posted by Chris Pratt <th...@gmail.com>.
Unfortunately that would still cause traffic to the server, which is
probably fine for an Intranet App, but wouldn't be too friendly if you have
dial-up internet users.
  (*Chris*)

On 10/26/06, Wendy Smoak <ws...@gmail.com> wrote:
>
> On 10/26/06, fea jabi <zy...@hotmail.com> wrote:
>
> > Is it possible in struts to disable the functionality of the enter key
> which
> > would usually execute the first submit button in the page. Can we do
> this at
> > form level?
> >
> > If so how to do this?
>
> http://www.google.com/search?q=struts+enter+submit
>
> I use an "invisible" submit button as the first button on the page.
> Enter submits the form via that button, and the [dispatch] action just
> re-displays the form.
>
> --
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: disable enter key functionality

Posted by Wendy Smoak <ws...@gmail.com>.
On 10/26/06, fea jabi <zy...@hotmail.com> wrote:

> Is it possible in struts to disable the functionality of the enter key which
> would usually execute the first submit button in the page. Can we do this at
> form level?
>
> If so how to do this?

http://www.google.com/search?q=struts+enter+submit

I use an "invisible" submit button as the first button on the page.
Enter submits the form via that button, and the [dispatch] action just
re-displays the form.

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: disable enter key functionality

Posted by Martin Gainty <mg...@hotmail.com>.
on submit or submitTag override the onClick property and or setup your own JS function to handle the onClick event

Anyone else?
M-
This e-mail communication and any attachments may contain confidential and privileged information for the use of the 
designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received
this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its 
conte
----- Original Message ----- 
From: "fea jabi" <zy...@hotmail.com>
To: <us...@struts.apache.org>
Sent: Thursday, October 26, 2006 5:01 PM
Subject: disable enter key functionality 


> Is it possible in struts to disable the functionality of the enter key which 
> would usually execute the first submit button in the page. Can we do this at 
> form level?
> 
> If so how to do this?
> 
> Thanks.
> 
> _________________________________________________________________
> Add a Yahoo! contact to Windows Live Messenger for a chance to win a free 
> trip! 
> http://www.imagine-windowslive.com/minisites/yahoo/default.aspx?locale=en-us&hmtagline
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

Re: disable enter key functionality

Posted by Chris Pratt <th...@gmail.com>.
It's definitely not something that Struts can do, but you can do that using
a JavaScript onkeypress handler that returns false if window.event.keyCode== 13.
  (*Chris*)

On 10/26/06, fea jabi <zy...@hotmail.com> wrote:
>
> Is it possible in struts to disable the functionality of the enter key
> which
> would usually execute the first submit button in the page. Can we do this
> at
> form level?
>
> If so how to do this?
>
> Thanks.
>
> _________________________________________________________________
> Add a Yahoo! contact to Windows Live Messenger for a chance to win a free
> trip!
>
> http://www.imagine-windowslive.com/minisites/yahoo/default.aspx?locale=en-us&hmtagline
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>