Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

input type=image with JS

 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My submit button is of input type and has a JS function in the onClick attribute.
The JS function submits the form when the function returns true, otherwise, the form is not submitted.
When I replace this button with an image the form is submitted even when the function returns false.
Any ideas?
Thanks,
Dan
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here are the code segments -
Works -

Doesn’t work -
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The dash in the on-Click was forced upon me by the Javaranch HTML disabler ;-(
 
Randall Twede
Ranch Hand
Posts: 4371
3
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
perhaps the problem is in the function
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The solution is -

Thanks,
Dan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic