Closed Bug 392997 Opened 17 years ago Closed 5 years ago

When using <input type=image usemap= > in a form, it fails to submit the form when clicking the mapped image

Categories

(Core :: DOM: Core & HTML, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 392994

People

(Reporter: rob, Unassigned)

Details

(Whiteboard: INVALID?)

User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/522.11.1 (KHTML, like Gecko) Version/3.0.3 Safari/522.12.1
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6

Using <input type=image usemap= > should allow authors to treat an image as a submit button. When referencing an image map from the image submit button , the submit capability does not work. The image is mapped with area elements, but clicking on those areas (or off any area) does not submit the form.



Reproducible: Always

Steps to Reproduce:
1. Create a page with a form using <input type=image' usemap=> pointing to an image map with defined areas.
2. Clock on the mapped image.

Actual Results:  
Form should submit.

Expected Results:  
Nothing happens.

See bug#189643 which is related, but mis-specified.

Some sample page code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" >
	<title>Untitled</title>

</head>
<body>


<p>
<map name=m>
	<area id=leftarea title='left-side' alt='left-side' shape=rect coords='0,0,100,100' >
	<area id=rightarea title='right-side' alt='right-side' shape=rect coords='100,0,200,100' >
</map>
</p>

<form onsubmit='alert("submit")' action=.><input type=image src=image usemap='#m'></form>

</body>
</html>
I mistakenly listed the wrong related bug above. The related mis-specified bug is bug#392994
Could you quote the relevant part of the spec that says this should happen? As far as I can tell HTML4's requirements do not say anything about image maps ever submitting a form.
Whiteboard: INVALID?
(In reply to comment #2)
That's how INPUT element's are used when they're type is set to 'image'. This is how both IE and Safari behave. Even when an image map is associated with an INPUT, clicking on the image submts the enclosing form. So nothing about adding the usemap attribute changes what the spec says about the INPUT element of type='image'. It remains a graphical submit button. If you think adding usemap should change an INPUT type=image to not submit a form, please quote the portion of the spec that says so. As for what the spec says about INPUT elements of type 'image',  from (http://www.w3.org/TR/html4/interact/forms.html#h-17.4.1 (emphasis added with "***"):

INPUT
"image
Creates a graphical submit button. The value of the src attribute specifies the URI of the image that will decorate the button. For accessibility reasons, authors should provide alternate text for the image via the alt attribute.
***When a pointing device is used to click on the image, the form is submitted*** and the click coordinates passed to the server. The x value is measured in pixels from the left of the image, and the y value in pixels from the top of the image. The submitted data includes name.x=x-value and name.y=y-value where "name" is the value of the name attribute, and x-value and y-value are the x and y coordinate values, respectively."
Whiteboard: INVALID?
Please never change someone else's status whiteboard markings. That is an egregious breach of the Bugzilla etiquette.

Regarding your answer to my question, I see nothing suggesting that the section you cite is not to be overriden by the usemap section. In fact, given that it would be impossible to follow both sections (following the URI given by the <area> element as well as submitting the form) it seems unlikely that the spec requires the behaviour you describe. Note in particular that the comment in the DTD for "usemap" on <input> says "use client-side image map", not something like "also use client-side image map".

Marking INVALID based on lack of support from the HTML4 spec. It is unclear what it would mean to implement the requested feature, since it would seem to contradict other text in the spec that is also implemented.
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → INVALID
Whiteboard: INVALID?
(In reply to comment #4)
> Please never change someone else's status whiteboard markings. That is an
> egregious breach of the Bugzilla etiquette.

Sorry about that. I didn't know it was off limits to edit that field.

> Regarding your answer to my question, I see nothing suggesting that the section
> you cite is not to be overriden by the usemap section. In fact, given that it
> would be impossible to follow both sections (following the URI given by the
> <area> element as well as submitting the form) it seems unlikely that the spec
> requires the behaviour you describe. 

The AREA elements in a client-side image map for the INPUT element do not typically have the href attribute on them. generally that would indicate an authoring error (though it could also be intentional if some areas of the image map were intended to follow an URL instead).

> Note in particular that the comment in the
> DTD for "usemap" on <input> says "use client-side image map", not something
> like "also use client-side image map".

You misunderstand the recommendation. Why would the DTD include a usmap attribute on the INPUT  element if it didn't mean to use the client-side image map for that element. So when the DTD says

 usemap      %URI;          #IMPLIED  -- use client-side image map --

This is a declaration of the attribute. It is not advice to the author to use a different element.
 
> Marking INVALID based on lack of support from the HTML4 spec. It is unclear
> what it would mean to implement the requested feature, since it would seem to
> contradict other text in the spec that is also implemented.

Could you point to the text in the recommendation that you are referring to? I'm going to reopen since, there's nothing you've said that indicates this is invalid.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
The bug as filed is INVALID. <area> elements without href= are per HTML4 not clickable. As you say, it may be desirable to follow Safari and IE and not support usemap= for <input> at all.

(I would also suggest you read Hixie's comments more carefully. He meant something different with his comment regarding the DTD.)
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago17 years ago
Resolution: --- → INVALID
(In reply to comment #6)

AREA elements for IMG referenced image maps do not follow the absent href (thoug certainly are clickable and should register an event). AREA elements for INPUT referenced image maps are clickable, register an event and should submit the form (like any INPUT whose type is 'image'). It would be helpful to cite specific portions of the recommendation if you're trying to make a case for INVALID.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
(In reply to comment #6)
> it may be desirable to follow Safari and IE and not
> support usemap= for <input> at all.

Safari and IE both support submission of forms with <input type=image usemap=#IDREF >, where IDREF is the name of a MAP element. This is exactly the behavior I'm proposing for Gecko.

Also,  the recommendation says: 

"The submitted data includes name.x=x-value and name.y=y-value where "name" is the value of the name attribute, and x-value and y-value are the x and y coordinate values, respectively."

In keeping with the spirit of the the recommendation, it would also be valuable to include name.area=area-id in the submitted data, where "name" is the value of the MAP element's name attribute and  'area-id' is the value of the AREA element's id attribute.
Component: HTML: Form Submission → DOM: Core & HTML
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.