Im using an image input field and i need to check if it was clicked
For <input type=“submit” /> i can just do
// Do Stuff
but this doesnt work with <input type=“image” />, it is never defined.
<input type="image" name="MySubmitButton" />
Always name your form elements. Eliminates the guess work.
i always do a switch on cgi.request_method, its the most portable.
the form goes here
form processing here
man, its cfswitch day!
The problem is ive more than one submit button on my form. One button is for saving, one button is for deleting selected items.
<form action="file.cfm" method="post">
// form stuff in here
<input type="submit" name="SaveItemsButton" value="Save" />
<input type="submit" name="DeleteSelectedItemsButton" value="Delete" />
When the above form is submitted, i can check which button was clicked by going
// code to save
// code to delete
This works fine. But i want to be able to do the same thing with the inputs being of type “image” instead of “submit”. Is this possible?
If you want to see that an image button was clicked, try this:
<input type="image" name="mysubmit" />
//code for imagebutton clicks
Image buttons send more than one value:
[name].x - x-coordinate of where in the image it was clicked.
[name].y - y-coordinate of where in the image was clicked.
[name] - value of the image button input.
Weird how Form.MySubmit isnt defined but Form.MySubmit.x is
ok, got to use the ‘value’ attribute for the input tag for Form.MySubmit to be defined