473,762 Members | 6,570 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Don't submit form on Enter button

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

Jul 10 '07 #1
24 8442

"MichaelK" <Ka*******@west .zomax.comwrote in message
news:Of******** ******@TK2MSFTN GP02.phx.gbl...
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.
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
Jul 10 '07 #2
It's still going to fire up submit on every Enter and run the code.

Michael

"Anthony Jones" <An*@yadayadaya da.comwrote in message
news:uL******** ******@TK2MSFTN GP04.phx.gbl...
>
"MichaelK" <Ka*******@west .zomax.comwrote in message
news:Of******** ******@TK2MSFTN GP02.phx.gbl...
>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.

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


Jul 10 '07 #3
[Please don't toppost on USENET]

MichaelK wrote:
>...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.
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 $500 per message. Use
of this email address implies consent to these terms.
Jul 10 '07 #4


"MichaelK" <Ka*******@west .zomax.comwrote in message
news:uL******** ********@TK2MSF TNGP06.phx.gbl. ..
Thanks guys for responds.
I already figured it out.
Just had to change the type from "submit" to "button". Had this problem
long
long time ago, just forgot how I solved it that time.
Seems it's what Anthony was metioned.

About standard Tab - I know that, just the forms were written for our
internal data entry people,
and it's a pretty difficult task to make them to don't press Enter every
time and use Tab instead.
So it was easier to capture Enter key and send them to the next entry
field.

Makes you wonder what they were using before that taught them to use the
enter button. If you perpetuate that it may be fine for this application but
still continue to be a source of confusion for them the when using other
applications. A better approach would be a bit of training, they'll get
used it.
--
Anthony Jones - MVP ASP/ASP.NET
Jul 12 '07 #5
Anthony Jones wrote on 12 jul 2007 in
microsoft.publi c.inetserver.as p.general:
Makes you wonder what they were using before that taught them to use
the enter button. If you perpetuate that it may be fine for this
application but still continue to be a source of confusion for them
the when using other applications. A better approach would be a bit
of training, they'll get used it.
Like [IE example]:

<input type='text'
onkeypress=
'if (event.keyCode= =13){
alert("Get used to not to use <enterhere, stupid!");
alert("I expected that question. Why not use <tab>");
return false;
};'
>
?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 12 '07 #6

"Evertjan." <ex************ **@interxnl.net wrote in message
news:Xn******** ************@19 4.109.133.242.. .
Anthony Jones wrote on 12 jul 2007 in
microsoft.publi c.inetserver.as p.general:
Makes you wonder what they were using before that taught them to use
the enter button. If you perpetuate that it may be fine for this
application but still continue to be a source of confusion for them
the when using other applications. A better approach would be a bit
of training, they'll get used it.

Like [IE example]:

<input type='text'
onkeypress=
'if (event.keyCode= =13){
alert("Get used to not to use <enterhere, stupid!");
alert("I expected that question. Why not use <tab>");
return false;
};'

?

That would not be my prefered way to do it.

I would book a conference room with a projector and show them a number of
applications which demonstrate that the tab is the industry wide field
navigation button. Apologise prefusely to them for having them use an
application in the past that did not conform to this standard and could they
please use the tab button from now on.

Be sure not to make them feel stupid, the fault lies with the management not
them.

--
Anthony Jones - MVP ASP/ASP.NET
Jul 12 '07 #7
Anthony Jones wrote on 12 jul 2007 in
microsoft.publi c.inetserver.as p.general:
>
"Evertjan." <ex************ **@interxnl.net wrote in message
news:Xn******** ************@19 4.109.133.242.. .
>Anthony Jones wrote on 12 jul 2007 in
microsoft.publ ic.inetserver.a sp.general:
Makes you wonder what they were using before that taught them to
use the enter button. If you perpetuate that it may be fine for
this application but still continue to be a source of confusion for
them the when using other applications. A better approach would be
a bit of training, they'll get used it.

Like [IE example]:

<input type='text'
onkeypress=
'if (event.keyCode= =13){
alert("Get used to not to use <enterhere, stupid!");
alert("I expected that question. Why not use <tab>");
return false;
};'
>

?

That would not be my prefered way to do it.

I would book a conference room with a projector and show them a number
of applications which demonstrate that the tab is the industry wide
field navigation button. Apologise prefusely to them for having them
use an application in the past that did not conform to this standard
and could they please use the tab button from now on.

Be sure not to make them feel stupid, the fault lies with the
management not them.
An expensive way to teach them and have them not feel stupid, Anthony.

Feeling stupid has nothing to do wich whose fault it is, but is a mighty
strong incentive for a steep learning curve.

Perhaps the word "stupid" should only appear after the third <enter>?

My way they would not see those two alerts any more in an hour,
and also target the ones that are on holyday, congress, ill, sick,
buzy elsewhere or just too sleepy during your "conference room with a
projector" happening to notice.

However, in a setting where money is no object, and absolute politeness
is, your idea might eventually work.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 12 '07 #8

"Evertjan." <ex************ **@interxnl.net wrote in message
news:Xn******** ************@19 4.109.133.242.. .
Anthony Jones wrote on 12 jul 2007 in
microsoft.publi c.inetserver.as p.general:

"Evertjan." <ex************ **@interxnl.net wrote in message
news:Xn******** ************@19 4.109.133.242.. .
Anthony Jones wrote on 12 jul 2007 in
microsoft.publi c.inetserver.as p.general:

Makes you wonder what they were using before that taught them to
use the enter button. If you perpetuate that it may be fine for
this application but still continue to be a source of confusion for
them the when using other applications. A better approach would be
a bit of training, they'll get used it.


Like [IE example]:

<input type='text'
onkeypress=
'if (event.keyCode= =13){
alert("Get used to not to use <enterhere, stupid!");
alert("I expected that question. Why not use <tab>");
return false;
};'


?
That would not be my prefered way to do it.

I would book a conference room with a projector and show them a number
of applications which demonstrate that the tab is the industry wide
field navigation button. Apologise prefusely to them for having them
use an application in the past that did not conform to this standard
and could they please use the tab button from now on.

Be sure not to make them feel stupid, the fault lies with the
management not them.

An expensive way to teach them and have them not feel stupid, Anthony.

Feeling stupid has nothing to do wich whose fault it is, but is a mighty
strong incentive for a steep learning curve.
What does that mean??
>
Perhaps the word "stupid" should only appear after the third <enter>?
If the OP follows my suggestion on the code tweaks nothing happens when
enter is hit.

If he also takes the time to explain respectfully how and why the new
interface is different no one ever needs to be called stupid, especially not
by a mere computer.
My way they would not see those two alerts any more in an hour,
and also target the ones that are on holyday, congress, ill, sick,
buzy elsewhere or just too sleepy during your "conference room with a
projector" happening to notice.

However, in a setting where money is no object, and absolute politeness
is, your idea might eventually work.
Since I have actually managed people and have had to do things similar to
that in the past I can tell you it isn't expensive or pointless and it does
work. People should treat people with respect, computers should treat
people like gods.

--
Anthony Jones - MVP ASP/ASP.NET

Jul 12 '07 #9
Anthony Jones wrote:
"MichaelK" <Ka*******@west .zomax.comwrote in message
news:uL******** ********@TK2MSF TNGP06.phx.gbl. ..
>Thanks guys for responds.
I already figured it out.
Just had to change the type from "submit" to "button". Had this
problem long long time ago, just forgot how I solved it that time.
Seems it's what Anthony was metioned.

About standard Tab - I know that, just the forms were written for
our internal data entry people,
and it's a pretty difficult task to make them to don't press Enter
every time and use Tab instead.
So it was easier to capture Enter key and send them to the next
entry field.

Makes you wonder what they were using before that taught them to use
the enter button.
?
Most Windows apps: Excel, Access, etc., use the Enter key for field/cell
navigation. Even Word: you press Enter to get to a new line, not Tab.
:-) It sounds like you turned on your first computer to a browser and ran
nothing except that for your entire computing life ... ;-)
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 12 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6048
by: Mark Michel | last post by:
Hi. I have made an html form which I would like to send by e-mail. When the recipient receives the e-mail form, I would like them to be able to fill it out and click the Submit button which will submit to an ASP page. This ASP page contains the code to submit the form data to a database. The page works fine when viewed through a browser, but the form will not submit in Outlook 2002 (I haven't tried other mail programs). Any...
7
20929
by: Rui Pestana | last post by:
Hello all, I want to use the POST method to submit the form and then grab the parameters in the asp file with request.form("parm"). The problem is that I am using the _search target to open the asp page. When I use _blank target there is no problem, either I use GET or POST method. But when I use _search target, only GET method works.
2
1866
by: Matt | last post by:
The problem is I have 3 buttons that need to submit the form to different URL. My approach is to declare <input type="submit"> rather than <input type="button">. And put the following in the JavaScript: InputForm.action="URL LOCATION" InputForm.method="POST"; I think we don't need InputForm.submit(); because <input type="submit">.
2
73379
by: Terence Parker | last post by:
How does one go about submitting a form with a link - but submitting it to a new window AND to a page different to that described within the action="" option of the <form> tag? Say, for example, I have a simple form such as the following: <form method="POST" action="submit.php" name="AForm"> Name: <input type="text" name="Name" length="20"><br> Age: 15 <a href="age.php">change age</a><br> <input type="submit" name="submit"...
19
2169
by: Bruce Duncan | last post by:
I know this isn't a php group but I was wondering if my problem is with my javascript in my php code. I'm debugging someone else's code and I can't figure out why this form won't submit. This code doesn't do anything: <?PHP $var1 = "http://localhost/php/index.php"; $varx = "bruce"; echo "<form name='formx3' method='post'><input type='text'><input type=button value=go onclick=document.formx3.action='".$var1."';
1
2799
by: Matt | last post by:
The problem is I have 3 buttons that need to submit the form to different URL. My approach is to declare <input type="submit"> rather than <input type="button">. And put the following in the JavaScript: InputForm.action="URL LOCATION" InputForm.method="POST"; I think we don't need InputForm.submit(); because <input type="submit">.
6
1921
by: nikou_70 | last post by:
I have a page with image, image has some image map, I want to submit form when user mouseover that image map, my code is like this: <img src="Images/floor4.jpg"usemap="#planetmap" id="IMG1"> <map id="planetmap" name="planetmap"> <area id=f4 shape="circle" coords="65, 93, 11" alt="CF4588" onmouseover=overf4()>
1
2104
by: tuckertickler | last post by:
I am brand new to this and trying to get a "submit form" to enter it's information into a database I have with www.servage.com. They have MySQL and I have created a database with their system. I just don't know the principal or procedure to gather information from a submit form (ie customer information) and transfer that to my database, or else also how to show or track customer balances and transaction histories. Is there any packaged system...
0
9378
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10137
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9927
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9812
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8814
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7360
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5268
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3914
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.