jQuery in Action, 2nd edition*
The moose likes HTML, CSS and JavaScript and the fly likes Opera submits form on enter Explorer dont ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Opera submits form on enter Explorer dont ?" Watch "Opera submits form on enter Explorer dont ?" New topic
Author

Opera submits form on enter Explorer dont ?

Frank Jacobsen
Ranch Hand

Joined: May 17, 2002
Posts: 353
I call a javascript from a input field, the only thing this javascript does is alert("FRANK");

When i type ok in the box, IE dont submit the form, Opera submits the form...

I dont want to submit the form, do anyone noes what to do about this ???

Frank


[ August 23, 2005: Message edited by: Bear Bibeault ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Is it possible to see the code that you are using?

Eric
Garann Means
Ranch Hand

Joined: Jan 28, 2002
Posts: 214
If you don't want to submit the form, don't specify an action for it and add onsubmit="return false;" to the form tag.
Frank Jacobsen
Ranch Hand

Joined: May 17, 2002
Posts: 353
The code is this:



In IE and Firefox nothing happens when i hit the enter buttom, in this field, in Opera, the form is automaticly submitted ???

I have other fields that must be submitted on enter !

I can maybe code a function that teturn something like this:

return !(window.event && window.event.keyCode == 13);

but is this nessesary ???

Frank
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Quick question, is there only one text field in the form?

Eric
Frank Jacobsen
Ranch Hand

Joined: May 17, 2002
Posts: 353
no there are 3 input fields !


Frank
 
 
subject: Opera submits form on enter Explorer dont ?