1

I have a control:

<input id="trigger_update_submit" type="image" src="images/green_flag.png" alt="" name="set_this" value="uu" />

This control is activated by some javascript:

document.getElementById('trigger_update_submit').click();

The problem is that the value of "uu" is not posted to the receiving page. All other controls work as they should but they are actually clicked on by the user.

I have a work around but I would rather use this method since I have other submit controls and would like to use the same handler.

Thanks!

Edit: Just want to mention that the .click() event fires as part of a larger JS function which is called by a different button so I cant use the onClick event of the trigger_update_submit control.

1 Answer 1

1

input type=image expects to send the x,y coordinates of your click within the image. If you "click" it via JavaScript it cannot find your mouse coordinates since the mouse is outside the image.

Sign up to request clarification or add additional context in comments.

6 Comments

Ill check that out. Just want to mention that the click(); does submit , it just does not pass the value.
That is expected since the button cannot figure out where the click occurred.
@William have you tried using something like the Firefox "TamperData" plugin to examine your HTTP request? I find it very useful to be able to see exactly what the browser is sending to the server.
@Diodeus however the input element has a value attribute, and the coordinates of the mouse are not necessary to determine that.
I agree, Pointy. Go figure. :)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.