Meaningless Drivel is fun!*
The moose likes HTML, CSS and JavaScript and the fly likes Preventing input type= 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 "Preventing input type="image" to submit" Watch "Preventing input type="image" to submit" New topic
Author

Preventing input type="image" to submit

Jiri Nejedly
Ranch Hand

Joined: Oct 22, 2002
Posts: 83
Is there any wat to prevent <input type="image"> to submit a form? I tried to add onclick attribute, code from there was run, but form was submitted anyway. Any other chance? Thanks.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Setting onsubmit="return false;" to the form tag ?


[My Blog]
All roads lead to JavaRanch
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42946
    
  70
Why make the image a button in the first place, if you don't want it to trigger a form submit?
Jiri Nejedly
Ranch Hand

Joined: Oct 22, 2002
Posts: 83
Long story, all buttons in form are <input type="image"> and all submit this form. Only one new specific button puts some data into opener window and doesn't need to submit.
Never mind. I'll make this specific button an <img>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Preventing input type="image" to submit