I have multiple images inside one form. Depending on the image clicked a specific value should be sent with a POST.
Can this be done without javascript? (I use jquery, if not).
I tried something like this:
<input type="image" name="type" value="1" src="images/type1.jpg" />
But only the coords of the image were sent, not type=1.
The safe approach to this problem is to give the inputs unique names and see which one sends coordinates.
Only the successful control will send any data. So test to see if
submit_blue.xhas a value, then test ifsubmit_red.xhas one.There is no need to involve JavaScript at all.
Alternatively, use regular submit buttons instead of server side image maps.
… keeping in mind that this will break in old-IE as it doesn’t support
<button>properly.