cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: [OT] input type="image" request param names
Date Sun, 28 Nov 2004 17:05:46 GMT
On 28.11.2004 15:59, Sylvain Wallez wrote:

>> In our CForms Action.java [1] there is a comment about an IE bug with 
>> appending 'x' and 'y' to the name of the input field when it is of 
>> type image:
>>
>> Special workaround an IE bug for <input type="image" name="foo"> :
>> in that case, IE only sends "foo.x" and "foo.y" and not "foo" whereas 
>> standards-compliant browsers such as Mozilla do send the "foo" parameter.
>>
>> 1. I "found out" IE *is* standards compliant [2]:
>> 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.
> 
> Well, what's the meaning of "the submitted data *includes* name.x..."?
> 
> The paragraph above that one says it "creates a graphical submit 
> button". Following the "submit button" link says that it "submits a 
> form" which in turns links us to the "Form submission" paragraph [3], 
> where "Successful controls" says that "every successful control has its 
> control name paired with its current value as part of the submitted form 
> data set" and that "If a form contains more than one submit button, only 
> the activated submit button is successful."
> 
> So, my interpretation is that clicking an input of type image makes it a 
> successful control and that therefore its name/value pair should be 
> sent, and that *additionally* the x and y coordinates should be included.

Makes sense.

>> 2. My Mozilla 1.7 behaves the same way, both in quirks and standards 
>> compliance mode.
> 
> Uh? I initially tested image inputs with no problems with Mozilla and 
> then added this workaround after testing with IE.
> 
> I just made a quick test with Firefox 1.0 on my Mac, and it does send 
> the input name also:
> 
> <html>
> <head><title>test</title></head>
> <body>
>  <form action="test-img.html" method="GET">
>    <input name="text"/>
>    <input type="image" src="pic.jpg" name="img" value="Click"/>
>  </form>
> </body>
> </html>
> 
> Clicking on the image leads me to 
> file://.../test-img.html?text=blah&img.x=42&img.y=36&img=Click
> 
> So, where's the truth?

Hmm, tested it without a value and got the impression Mozilla behaves 
like IE, but you are right, with a value img=Click is sent too. But - 
and this is at least inconsequent then - Mozilla does send a request 
param for a submit button if the button has no value. It does not do 
this for the image:

<html>
<head><title>test</title></head>
<body>
  <form action="test-img.html" method="GET">
    <input type="image" src="pic.jpg" name="img" value="click"/>
    <input type="submit" name="button" value="click"/>
  </form>
</body>
</html>

@value=click:
file://../test-img.html?button=click
file://../test-img.html?img.x=105&img.y=84&img=click

without @value:
file://../test-img.html?button=
file://../test-img.html?img.x=88&img.y=27

Joerg

Mime
View raw message