"Matt Herson" <> wrote in message
news:bl9j0e$37d$...
> ok, assuming the dash is accepted, any ideas on how to accomplish the
change
> to the hidden field?
<snip>
>><URL: http://jibbering.com/faq/#FAQ4_25 >
>>-and-
>><URL: http://jibbering.com/faq/#FAQ4_39 >
<snip>
The whole task is unnecessary as <input type="image"> elements provide
name/value pairs in the request if they are given name attributes. Two
buttons with unique names would allow the button that was actually
clicked to be determined on the server by testing for the presence of a
value of each name (the name/value pairs will not be present for the
button that was not clicked).
For an <input type="image"> element the name value pairs are not the
same as with a normal submit button as they include the XY co-ordinates
of the mouse click. Given an element:-
<input type="image" name="submit1" src="[...].gif">
- the query string sent with a get request would be -
?submit1.x=0&submit1.y=0 - (similar information can be extracted from
post requests). Branching the code on the server based on this
information is trivial.
Otherwise, if you insist on making this dependent on JavaScript, you
will need to switch to setting the value of the hidden filed using a
bracket notation property accessor to avoid the invalid (for a
JavaScript identifier) characters in the field name. You will also nee
to cancel the default action of the <input type="submit"> buttons (which
is to submit the form), or cancel the submission of the form from the
onsubmit handler.
Richard.