• Post Reply Bookmark Topic Watch Topic
  • New Topic

input type="image" as submit?  RSS feed

 
Tim Hobbs
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd like to use an image as a submit button, but when I request the button name it is null? How do I work around this?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66154
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you specifying a name for the button?
bear
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think an image input sends its name the same way a submit button does, it just sends the (x,y) coordinates.
What you might want to do is make it an image that responds to a javascript on_click event and executes some javascript. This JS then sets a hidden variable (to simulate sending the button name) and then submit the form.
This is the way I've had to do it before, but that was because I was finding support for input images was poor, and this uses images wrapped in a href instead.
Dave.
 
James Swan
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah it uses modified name append with .x or .y
eg <input type="image" name="myimage" ... >
you can then check for "myimage.x" or "myimage.y" in the request.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!