Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Preventing input type="image" to submit

 
Jiri Nejedly
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Setting onsubmit="return false;" to the form tag ?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic