Jul 26, 2008

Enter Keypress Submits Wrong Button

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > HTML, XML etc..

free web hosting

Enter Keypress Submits Wrong Button

kvarnerexpress
Ive got a form, with a submit button on the left and a submit button on the right. By default on the enter keypress, the form submits the left submit button, but i want it to submit the right button. How would i accomplish this?
kvarnerexpress

Reply

SystemWisdom
You should only have one submit button (type="submit") and make the other button a normal button (type="button") which has its own onclick event handler..

Example:
CODE


<html>
<head>
<script language="JavaScript"><!--

function doSubmit( e )
{
  var keyCode = (window.Event) ? e.which : e.keyCode;
  if( keyCode == 13 ) document.forms[0].submit();
}

function doSomethingElse()
{
   alert("Something else");
}

//--></script>
</head>

<body>

<form name="MyForm">

<input type="text" name="blah" value="" onkeypress="doSubmit(event)" />

<input type="button" value="Some Button" onclick="doSomethingElse()" />

<input type="reset" value="Clear" />

<input type="submit" value="Submit" />

</form>

</body>
</html>


I hope that helps!

 

 

 


Reply

Mike
Or you could simply add an extra field to the code used to produce the submit button. Your submit button is probably <input type="submit" name="blah" value="Blah" />, but you can add an extra field that makes it so the user could click ALT then another letter or number to get it to work. For example:

<input type="submit" name="blah" value="blah" accesskey="r" />

would make it so if the user pressed down on ALT + 4, the button would b e clicked.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : enter, keypress, submits, wrong, button

  1. Borrowing To Invest In Shares: Getting It Right And Wrong [SPAM]
    Let this tips in margin trading before you have your fingers burnt. (2)
  2. Configuring The Httpd.conf And Php.ini
    Where did I go wrong? (7)
    Hey guys! I installed Apache2.2.x on my machine running on XP SP3 and it worked. When I tried
    to install php5 from a .msi I then got " Error trying to access httpd.conf file. You will need to
    manually configure the web server. " This is a re-installation on a machine that had php5, Apache2.2
    and MySQL, all running in hamony. After "manually configuring the server" (editing the httpd.conf) I
    restarted Apache and when I try to open a .php file I get a blank page and the browser says
    "done". Tried phpinfo () but I still get the blank page. Now I don't know wh....
  3. Cd Drive Eject Button Problem
    see inside for explanation (3)
    i have a old dvd burner that is very reliable. the only problem that i have is the eject button on
    that thing is a little busted. i know you can right click to eject it but how can i return it(after
    you put a cd you press that thing to let the cd go inside) it is an old one and you push the cd
    holder like the other one i have. my question is, is there a way to program it or such. because one
    burner program has an option like this and it works. but the program isnt free.....
  4. What Is Wrong With Consumers Today?
    Horror Stories of Customer's from the Retailer's Point of View (7)
    If you work in retail or any other customer-based environment, I want to hear replies on
    customer's who are stupid, mean, ignorant, or just down-right retarded: I am the asst mgr. of a
    well-known electronic retail store. I had a customer come in who wanted to return something. So I
    followed procedure to a tee. I asked her to enter her phone number on a pad. She asked why. I
    said it was required for the return. I then asked her for her name and address. "You don't need
    that." "Yes, I do, ma'am. Our company tracks all returns." "I'm not telling you"....
  5. Could Someone Please Review My Site.
    Help...what did i do wrong? (17)
    So i followed jlhaslip's advice and got rid of the .tk domain, still no more visitors. I've
    told everyone on my contact list, posted it to blogs and forums and still not many people visit my
    site... What's wrong with it, i just spent 30 minutes (not long but hey) re-vamping the forum so
    its now friendly to guests (i think that might of been a mistake but hey). It has 95 ish good
    working games, a guest book, its on Google, it has a search engine, contact us form about us form
    nearly everything i can think of. So please tell me whats wrong with it and what i c....
  6. Something Wrong?
    (4)
    Ok so for the last couple of weeks, ive been feeling ODD. All of the sudden ive lost appetite, i
    smell food, want to eat it, but i cant, the minute i try to, i just feel disgusted/or full even if i
    havent eaten anything, & stop. My stomach rembles but its not hungry? no im not pregnant, someone
    asked me that lmfao.. thats a NO! lol anywho, ive also been feeling extra thirsty lately, and
    wanting to urinate a lot, idk whats wrong with me? i just feel sick, anxious, & disgusted by many
    things, i cant even look at myself in the mirror, it just puts me in whatever mode ev....
  7. Flash Problem
    sometimes the buttons will load the wrong link. (9)
    Its weird but sometimes when you hit the forums or roster button on my flash banner it will load:
    www.childrenofconan.trap17.com/index.html instead of what its suppost to. It works fine, but if you
    mess around and click the buttons for a little bit you will notice this happening. This is a problem
    because people visiting the site will sometimes click the button once and be like oh I guess the
    link is broken and never come back, if anyone has a solution to what could be the problem it would
    be awesome. This is one of my first custom flash banners and im just confused what....
  8. Phpmyadmin Error
    Not able to enter PhpMyAdmin (4)
    Currently I try to access my PhpMyAdmin and I get the following error displayed among the screen:
    My PhpMyAdmin worked prior the migration but suddenly stopped working after. I wanted to know if
    anyone else is getting this error also or anyway can help me fix this o.o.....
  9. I Think I Made A Wrong Choice
    (5)
    So next year I am attending "videregående." I do not know what you call it, I guess the school
    system is a bit different. But this is my 10th school year, so next year will be my 11th. About two
    months ago, we had to make a choice what we wanted to do next year, and where we wanted to go. I
    decided to go with "Allmenn." The first year is very similar to all my previous school years, so it
    is about the same. They have the "normal classes", like English, mathematics, gymnastics, history,
    science and such. In the second and third year you get to choose what classes you want....
  10. Delaying The Time Until A Flash Button Can Be Pressed
    using actionscript (3)
    Can anyone tell me how can i make in flash a button that can not be pressed until an amount of time
    has past? let's say... about 5 mins i need this because i want to hold my visitors looking at
    the content on the page before they can advance further.....
  11. I Really Need Some Help
    Long Term Relationship Gone Soo Wrong (3)
    Hey everyone, thanks for taking your time in reading this. What it is that, im only 16 years old and
    have been with my boyfriend for almost 2 years, well i have been texting this boy from work, nothing
    bad, just as mates.. and i didnt tell my bf coz i no he will go mad, anyway he has found out and now
    he is saying he dot trust me, I love him so much, and i dont no whether he is goin 2 split up with
    me, over the last 2 days or so, i haven't been sleeping or eating properly, coz im so scared im
    goin 2 loose him. I no im young and got my while life ahead, but i love him....
  12. Drinking Cold Water
    A wrong concept of weight loss (2)
    Recently I found that, there is a wrong concept to many people that drinking cold water can reduce
    weight. They sowed me few interesting thermodynamics prove (actually they were wrong). They showed
    that if some one drinks cold water, it will be increase its temperature inside our body. In another
    word, it will burn few calories to increase its temperature. In this way, some one can burn their
    calories and can loose their weight. They also showed me if I drink 1000g (around 1 L) water
    having temperature 5 deg. C and it increase its temperature 25 deg C (to reach our b....
  13. Download Files Off Esnips.com
    even now that the download button is gone! (0)
    hey everyone, i am sure that many of you may have heard of esnips , which is basically online file
    storage/sharing. you can now find almost any file imaginable on esnips, and in many ways it is
    better than rapidshare. previously, once you are signed in to esnips, you were able to download any
    esnips file via a button only viewable to members. back then, there was a method to download any
    file without even signing in. then, probably due to legal issues, users were able to choose whether
    or not people could download their files. the hack mentioned above, though, still....
  14. The Atom
    Everything we've ever "known" is wrong. (8)
    I was just ponderings of the universe today and I thought to myself. If we have never seen an atom
    because it's far too small to see. How do we know that they are even real. I mean there could be
    this theory that is completely fool proof. The periodic table of elements might work perfectly and
    all the groups and rows and stuff might work perfectly but what if the atom is nothing like what we
    originally thought. It could change the idea of physics. To my understanding quantum physics (or
    something like that) depends primarily on the eratic movements of the electron. W....
  15. The Nhs
    What Went Wrong??? (0)
    Oh dear... Somewhere along the line the NHS and the British Government did something very wrong.
    Infectious diseases are reaping havoc such as MRSA and the only choice for the hospitals is to empty
    the building and then steam clean it completely. I think that we should completely reform the NHS
    ie. New chairman etc. Changes need to be made.....
  16. Suicide Is Wrong
    (37)
    Well since trap17 seems to be down.. or just my gay site, im going to talk about suicide and about
    how wrong it is. Ok first of all IF YOUR LIFE IS SO MISERABLE AND EVERYONE HATES YOU AND YOU JUST
    CANT TAKE IT ANYMORE why in the world would you give the things that are hurting you (most likely
    people duh) the joy the HAPPINESS of seeing you give up? and kill yourself! come on.. you are
    only making them happy not yourself! and so what you kill yourself thats it! theres no
    turning back once you kill yourself.. nothing.. unless your extremely religious and beli....
  17. Is Something Wrong With Me?
    (11)
    All the women I' have been with in the past few years starts losing weight after going out with
    me for a few months. Even if we're not having sex. i suspected psychological reasons at first,
    but all of them seem to be happy to be with me. Maybe it's just coincidental I don't know
    but it's really disturbing. Should I see a therapist? /sad.gif" style="vertical-align:middle"
    emoid=":(" border="0" alt="sad.gif" />....
  18. Robot Rights : Right Or Wrong
    (30)
    hi friends, actually this might seem quiet far fetched but it has come to my mind after reading an
    article in a very prominent science magazine. i was going through the magazine and i saw that their
    was this article in which a scientist of United kingdom has suggested that within 20 years their
    will be something of the sort of "Robot Rights" on the format of human rights and animal rights. i
    just was thinking since then that how much will it be right doing that...i mean i do not know... i m
    a strong supporter of developing artificial intelligence, though i am one of t....
  19. Islam, Not Terrorism
    Proving you wrong (35)
    KILLING INNOCENT PEOPLE - Many people say that Islam promotes violence, war etc. BUT it actually
    doesn't. What Allah does say is that do not be afraid when the kafirs (non-believers) start war
    with you. Islam only tells Muslims to put the fire out once it has been lit up, not to light the
    fire ourselves because that would be a sin. Allah Himself says in the Qur'an: QUOTE "...For
    persecution is worse than killing" Surah Al Baqarah, Chapter 2, Verse 217 "But the other's
    mind imposed him on the killing of his brother, so he slew him and became one of the....
  20. Multiple Drop Down Menus W/ Submit Button
    (6)
    I am building a page that will have 2 drop down menus and a submit button. The first menu will have
    one set of options, say colors (red, blue, green, yellow). The second menu will have another set of
    options, say sizes (small, medium, large). What I want to be able do is select a color and a size,
    click submit and have it go to the page for those options. So if a user picks 'Red' and
    'Small' and clicks submit they will be linked to page1.html. If they pick 'Blue' and
    'Large', they will be linked to page2.html, and so on. Any ideas how to ....
  21. The Icons Of Zip Files Are Wrong Everytime!
    Windows 2000 (3)
    Hello! I am going crazy for a silly little thing. Please help me anyone! The icon for
    ZIP files never shows the way it is supposed to. Instead it insists on displaying the Windows
    'default document' icon for ZIP files. If I rightclick a zip and choose icon properties, I
    can set the icon to be fetched from the winzip executable instead, and all looks fine and dandy
    inside the properties dialog, but after refreshing or repairing icon cache it is still the default
    document icon that is displayed. If I try to change the icon enough times it will ev....
  22. Refresh Page After Back Button Hit
    (11)
    Hi. I have a page that is dynamically build through DOM manipulation. So, when I browse outside the
    page, and then click back, those dynamically created DOM objects are gone. Since I am also using JSP
    / Servlet technology, I can rebuild this page easily, which I have done. Here is my dilemma. If
    the user leaves the dynamic page, then clicks back on their browser, I need the page they are going
    back to to refresh. I can't figure out how to do this. I've tried using the META tag, but it
    won't do it. Help would be appreciated. Thanks. ....
  23. My Teacher Is Wrong
    Complain about teachers here (12)
    Here is some background info: My english teacher is a german canadian christian. I am a russian jew
    who immigrated here 10 years ago. So anyway, I am talking to my friend Drew about how I am gonna be
    on vacation for winter break, right? Then my teacher interjects and says "i think it should be
    called christmas break because we are breaking for christmas, not hanukkah (looks at me) or Kwaanza
    (looks at some black kid in my class) because we are breaking for christmas which is the most
    important holiday" What an >!!!! I just want to punch him in his fat u....
  24. How To Create Java Button Or Frame
    to be customized (12)
    hi to all!!!! just like to ask if it would be possible if i could make a custom
    button or frame in java. i got tired of using the build infeatures in java. i would like to create
    my own dessign of button or frame.. can it be possible!!! /biggrin.gif' border='0'
    style='vertical-align:middle' alt='biggrin.gif' /> thank!!!! /laugh.gif'
    border='0' style='vertical-align:middle' alt='laugh.gif' /> New Help In! is NOT a descriptive
    topic title. Next time you decide not to follow the posting rules, you will be issued a w....
  25. Radio Button
    (4)
    I am trying to maintain the radio button selection on a Submit, but the form refreshes to its
    default selection. BTW, After a Submit is clicked, the radio form stays visible on the top of the
    screen while the query results are displayed on the bottom half of the screen (we're using an
    internal, embedded link). That's when the default selection comes into place. Any help would be
    appreciated. Please respond Kvarnerexpress.....
  26. Is Homosexuality Right Or Wrong?
    your views (217)
    I wondered what people feel about this? I personally believe that it's wrong and wouldn't
    mind chatting to others who believe otherwise to see what they think.....
  27. Button To Print Current Web Page
    (13)
    Hi, Does anyone know how to create a button that will printo out the current page. What I want to
    do is have the user fill out a form (containing name, address, zip, etc). They will then click on a
    "print" button and it will print out the form data. Any ideas? Thanks.....
  28. What Is Wrong With Being A Virgin
    Yes this is to be taken seriously but be warned :) (44)
    OH yeah I brought this topic here now > To start off i would like to say i am not a virgin. I
    havent been for some time, but i would like to see what your thoughts are on this. Society seems to
    look down upon them. anyone who hasnt slept with others for sexual pleasures is seemingly put down
    for some reason. that many are forced to lie about their situation just because they feel they need
    to. how sad is this? The practicality of it is that some ppl want to save themselves for that
    special person and i see nothing wrong with that. why is it that it for some reason matt....
  29. Psp Square Button Problem
    (12)
    QUOTE     Nearly 5,000 units are returned to Sony for buggy button; Kutaragi unapologetic about
    the handheld’s design.     TOKYO–About 4,800 Japanese PSPs have been returned to Sony due to
    problems with the handheld’s square button, according to a recent interview with Sony Computer
    Entertainment president Ken Kutaragi in Nikkei Business magazine.     Kutaragi acknowledged that
    the button is less responsive than the others, in part because it’s so close to the PSP’s 480x272
    screen. Because there isn’t enough room to put the square button’s detection switch directly ....
  30. Delphi Tutorial - Change Your Start Button Caption
    (4)
    How to change your start button caption using Delphi! (By the way, the start button will be
    renamed back to "start" after you restart your computer) Here we go! 1. Create a new project
    in Delphi 2. Add a Button and an Edit box to your form, place them where you want. 3. Double click
    the button to enter the code editor so we can type code for our OnClick event. 4. The code for the
    OnClick event of our button should look like this: CODE procedure
    TForm1.Button1Click(Sender: TObject); var Handle1,Handle2:hwnd; begin
    Handle1:=FindWindo....

    1. Looking for enter, keypress, submits, wrong, button

Searching Video's for enter, keypress, submits, wrong, button
Similar
Borrowing To
Invest In
Shares:
Getting It
Right And
Wrong [SPAM]
- Let this
tips in
margin
trading
before you
have your
fingers
burnt.
Configuring
The
Httpd.conf
And Php.ini
- Where did
I go wrong?
Cd Drive
Eject Button
Problem -
see inside
for
explanation
What Is
Wrong With
Consumers
Today? -
Horror
Stories of
Customer'
;s from the
Retailer'
;s Point of
View
Could
Someone
Please
Review My
Site. -
Help...what
did i do
wrong?
Something
Wrong?
Flash
Problem -
sometimes
the buttons
will load
the wrong
link.
Phpmyadmin
Error - Not
able to
enter
PhpMyAdmin
I Think I
Made A Wrong
Choice
Delaying The
Time Until A
Flash Button
Can Be
Pressed -
using
actionscript
I Really
Need Some
Help - Long
Term
Relationship
Gone Soo
Wrong
Drinking
Cold Water -
A wrong
concept of
weight loss
Download
Files Off
Esnips.com -
even now
that the
download
button is
gone!
The Atom -
Everything
we've
ever
"known&#
34; is
wrong.
The Nhs -
What Went
Wrong???
Suicide Is
Wrong
Is Something
Wrong With
Me?
Robot Rights
: Right Or
Wrong
Islam, Not
Terrorism -
Proving you
wrong
Multiple
Drop Down
Menus W/
Submit
Button
The Icons Of
Zip Files
Are Wrong
Everytime
3; - Windows
2000
Refresh Page
After Back
Button Hit
My Teacher
Is Wrong -
Complain
about
teachers
here
How To
Create Java
Button Or
Frame - to
be
customized
Radio Button
Is
Homosexualit
y Right Or
Wrong? -
your views
Button To
Print
Current Web
Page
What Is
Wrong With
Being A
Virgin - Yes
this is to
be taken
seriously
but be
warned :)
Psp Square
Button
Problem
Delphi
Tutorial -
Change Your
Start Button
Caption
advertisement



Enter Keypress Submits Wrong Button



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE