473,782 Members | 2,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get rid of focus on submit button of a form.

Hello All

I have a submit button in my form. It gets focus (is activated by
ENTER) everytime any text inputs are edited. So, if the user
press ENTER before finishing all form, the form is submited.

I would like to prevent this button to get focus, and make it
possible to be activated only by mouse, or by specific tabindex.
I have tried to use:
<BODY bgcolor="#DBF3A 7" onLoad="setfocu s()">, where setfocus()
sets a focus on other text element, but it works until the user
clicks on any text input. Than submit button gets focus again.

then I tried tabindex="32767 ", but with no success.

So, how to get rid of the focus on submit button?

Thanks in advance.
Pawel

Jul 23 '05 #1
2 7786
Pawel <no*****@poczta .onet.pl> wrote:
I have a submit button in my form. It gets focus (is activated by
ENTER) everytime any text inputs are edited. So, if the user
press ENTER before finishing all form, the form is submited.


It doesn't really get focus (though this is partly just a matter of
terminology); it just gets activated when Enter is hit in a text input
field.

This is an old problem. Not surprisingly, it's discussed in the FAQ
(though technically under the dual problem "How do I make a form so it
can be submitted by hitting ENTER?"). Briefly, you cannot prevent Enter
from submitting; you can deal with it when it happens (by coding form
data processing suitably). But check the resource recommended in the FAQ:
http://ppewww.ph.gla.ac.uk/%7Eflavel...mquestion.html

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 23 '05 #2
On Sun, 5 Sep 2004 10:39:17 +0000 (UTC), "Jukka K. Korpela"
<jk******@cs.tu t.fi> wrote:
Pawel <no*****@poczta .onet.pl> wrote:
I have a submit button in my form. It gets focus (is activated by
ENTER) everytime any text inputs are edited. So, if the user
press ENTER before finishing all form, the form is submited.


It doesn't really get focus (though this is partly just a matter of
terminology) ; it just gets activated when Enter is hit in a text input
field.

This is an old problem. Not surprisingly, it's discussed in the FAQ
(though technically under the dual problem "How do I make a form so it
can be submitted by hitting ENTER?"). Briefly, you cannot prevent Enter
from submitting; you can deal with it when it happens (by coding form
data processing suitably). But check the resource recommended in the FAQ:
http://ppewww.ph.gla.ac.uk/%7Eflavel...mquestion.html


And should you wish to follow the suggestion there to provide a
Javascript warning to the user (without causing extra problems for users
without Javascript) you might like to have a look at:
http://www.xs4all.nl/~sbpoley/webmatters/formval.html

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Jul 23 '05 #3

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

Similar topics

2
5086
by: Bettina | last post by:
I have a text field and I want that after I enter a text in this text field, the focus goes to the button.gif. How can I do it? Any ideas? I know that when you use an input type="submit", the focus goes automatically to the button, but I don't want to use a button. See please the piece of code: <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html;
2
5116
by: Mike Irwin | last post by:
I'd like to prevent a submit button from getting focus unless a particular textbox or radio button is selected. For example, if a user clicks anywhere within a form, the submit button is focused and will submit whatever data is present if the user accidentally presses Enter/Return. I would like to prevent this from happening unless the user's cursor is within a textbox or the selection is on a radio button. Is this possible? I believe...
1
2092
by: Martin Nadoll | last post by:
Hello, i have a little problem and no idea :-( i have a form with two buttons to submit it. One button (must be left) goes to a detail-page and the second button (must be right) goes to a basket-page. Also there is a input-field. My problem: onLoad i give focus to the input-field. But when user submits the form with return, the first button ("show
2
3729
by: jw56578 | last post by:
Is there a reason why setting focus to a textbox input, also gives focus to a submit button on the page, to where if you click enter in the text box, the submit button will be clicked.
5
1423
by: Tim Johnson | last post by:
Howdy: I'm just learning how to use focus() and select(). I have a very large form (360+ elements). Javascript validation is launched by the 'onclick' event handler in the "submit" button tag. Problem: When the element to be validated is not on the screen - since the form is larger than the screen, then there are no visual cues to help
2
1458
by: barry | last post by:
I was wondering why on a webform when I put the cursor into a textbox the focus goes to the only button on the form. thanks
10
3061
by: Perry van Kuppeveld | last post by:
Hi, I have a problem with formatting a table including text fields wich can contain up to 255 chars. I need a table with 3 columns: - First column 50 % over the with a rowspan of the total number of rows. - Second column 25 %, no rowspan - Third column 25 %, no rowspan
4
2736
by: Johannes Kiehl | last post by:
Hi group, I've been losing most of my remaining hair today, trying to track down a problem with IE6.0 (builds: .2600 and XP SP 2). I set the border-width of form input fields to 1px via inline CSS. But whenever I call the focus() method of any of the form fields, the border width of the (first) submit button changes to 2px. It doesn't matter whether the focus() method is called
1
2297
by: Sudarhan | last post by:
Hello frnds I have created a webbased form using asp and javascript .. while submitting the form i am validating the fields in the form .it validates the field and returns alert message. but when user clicks on alert box it submits the form instead of focusing to desired field... I have cascade style webform .so if havent filled field in 2nd sheet and i click on submit button in 4 sheet.. it prompts the alert box but does not focus to 2nd...
0
9639
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10080
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
9942
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
8967
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
7492
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
6733
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5378
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...
2
3639
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2874
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.