不要在Enter按钮上提交表单 [英] Don't submit form on Enter button

查看:94
本文介绍了不要在Enter按钮上提交表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁知道如何阻止在按下Enter按钮之前提交表格

表格上的所有字段都已填满。

人们只需输入第一个字段按Enter键并且它提交了表单并且

进行验证,

当然是用一堆消息刷新,因为其余的字段是空的。
我记得我有一些页面写下了下一个字段的代码

按下Enter按钮(Tab like),因为它没有去任何地方

all。

在几台机器上测试过,结果相同。


谢谢,

迈克尔

Who knows how to prevent submitting a form on the press Enter button before
all fields on the form are filled up.
People just enter the first field hit Enter and it submits the form and
doing validation,
of course flushing with the bunch of messages because rest of the fields are
empty.
I remember I had some pages where wrote the code to go on the next field
when pressed the Enter button (Tab like), because it didn''t go anywhere at
all.
Tested it on a few machines, same result.

Thanks,
Michael

推荐答案



" MichaelK" < Ka ******* @ west.zomax.com写信息

新闻:************** @ TK2MSFTNGP02.phx.gbl。 ..

"MichaelK" <Ka*******@west.zomax.comwrote in message
news:Of**************@TK2MSFTNGP02.phx.gbl...

谁知道如何阻止在按下时提交表格在$ b之前输入按钮
Who knows how to prevent submitting a form on the press Enter button



$ b

before


表格上的所有字段都已填写。

人们只需输入第一个字段按Enter键即可提交表格并且

做验证,

当然是用一堆邮件刷新,因为其余的字段
all fields on the form are filled up.
People just enter the first field hit Enter and it submits the form and
doing validation,
of course flushing with the bunch of messages because rest of the fields




are


空。

我记得我有一些页面在下一个字段写下代码

按下Enter按钮时(喜欢的标签,因为它没有去任何地方

all。

在几台机器上测试过,结果相同。
empty.
I remember I had some pages where wrote the code to go on the next field
when pressed the Enter button (Tab like), because it didn''t go anywhere at
all.
Tested it on a few machines, same result.



Tab是标准的下一个字段按钮。不要使用enter来进行这个

操作。为了避免提交,请在

的提交按钮的onclick事件中添加代码。如果没有填写所有字段,则返回false。


-

Anthony Jones - MVP ASP / ASP.NET

Tab is the standard ''next field'' button. Do not use enter for this
operation. To avoid submit on enter add code to the onclick event of the
the submit button. Return false if not all fields are filled in.

--
Anthony Jones - MVP ASP/ASP.NET


它仍然会在每次输入时启动提交并运行代码。


Michael


" ;安东尼琼斯 < An*@yadayadayada.com写信息

新闻:uL ************** @ TK2MSFTNGP04.phx.gbl ...
It''s still going to fire up submit on every Enter and run the code.

Michael

"Anthony Jones" <An*@yadayadayada.comwrote in message
news:uL**************@TK2MSFTNGP04.phx.gbl...

>

" MichaelK" < Ka ******* @ west.zomax.com写信息

新闻:************** @ TK2MSFTNGP02.phx.gbl。 ..
>
"MichaelK" <Ka*******@west.zomax.comwrote in message
news:Of**************@TK2MSFTNGP02.phx.gbl...

>谁知道如何阻止在按下时提交表格输入按钮
>Who knows how to prevent submitting a form on the press Enter button



之前

before


>表单上的所有字段都已填满。
人们只需输入第一个字段按Enter键即可提交表单并执行
验证,
当然用一堆消息刷新因为其余的字段
>all fields on the form are filled up.
People just enter the first field hit Enter and it submits the form and
doing validation,
of course flushing with the bunch of messages because rest of the fields




are


>空。
我记得我有一些页面写了下一个字段的代码
当按下Enter按钮(Tab like),因为它没有去任何地方

所有。
在几台机器上测试,结果相同。
>empty.
I remember I had some pages where wrote the code to go on the next field
when pressed the Enter button (Tab like), because it didn''t go anywhere
at
all.
Tested it on a few machines, same result.



Tab是标准的''next field''按钮。不要使用enter来进行这个

操作。为了避免提交,请在

的提交按钮的onclick事件中添加代码。如果没有填写所有字段,则返回false。


-

Anthony Jones - MVP ASP / ASP.NET


Tab is the standard ''next field'' button. Do not use enter for this
operation. To avoid submit on enter add code to the onclick event of the
the submit button. Return false if not all fields are filled in.

--
Anthony Jones - MVP ASP/ASP.NET



[请不要反对USENET]


MichaelK写道:
[Please don''t toppost on USENET]

MichaelK wrote:

> ...为了避免提交,请在
提交按钮的onclick事件中添加代码。如果没有填写所有字段,则返回false。
>...To avoid submit on enter add code to the onclick event of the
the submit button. Return false if not all fields are filled in.



它仍然会在每次输入时激活提交并运行代码。


It''s still going to fire up submit on every Enter and run the code.



这与安东尼写的内容完全矛盾。返回[false]

取消活动。

-

戴夫安德森


未经请求的商业广告电子邮件将以

That is directly contradicted by what Anthony wrote. Returning [false]
cancels the event.
--
Dave Anderson

Unsolicited commercial email will be read at a cost of


这篇关于不要在Enter按钮上提交表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆