[thelist] Form processing problem in IE and Opera with input type=image

Andrew Clover and-evolt at doxdesk.com
Tue Nov 9 03:57:35 CST 2004


Dan Leonard <dan at canopyroad.com> wrote:

> I've spent a couple of hours now trying to figure out why this form will
> submit with no problems in Mozilla 1.7.1, but not in IE6 or Opera 7.54.

Here's the problem:

   <input name="Submit" type="image" value="Submit">

Specifying 'value' on image inputs gives inconsistent results. If you 
turn it into a GET form you can more easily see what the browsers do in 
this situation - Mozilla:

   Submit.x=93&Submit.y=22&Submit=Submit

vs. IE:

   Submit.x=93&Submit.y=22

That is, Mozilla submits the name/value pair *as well as* the click 
co-ordinates, but IE and Opera submit them *instead*. The HTML 4.01 spec 
doesn't to my eyes endorse one or the other approach - only section 
17.4.1 mentions the .x/.y suffixes and there's nothing mentioning it in 
17.13.

Indeed, by one interpretation a browser might just pass the name/value 
and forget about the .x/.y co-ords, if it wasn't clicked by a mouse. All 
browsers I've seen do pass the co-ords though; Mozilla for example uses 
(0, 0) if the control is activated by keyboard.

> I'm using PHP to process the form.

If PHP isn't doing it for you, you'll have to sniff for the existence of 
the '.x'/'.y' values manually. Or use a 'hidden' input to flag the 
'form-being-submitted' condition - this is generally safer as in general 
the submit button value might not always be included if the form is 
submitted a different way, eg. pressing return.

-- 
Andrew Clover
mailto:and at doxdesk.com
http://www.doxdesk.com/


More information about the thelist mailing list