IE form image type - not playing nice

IE form image type - not playing nice

am 03.07.2007 14:16:19 von wizardharry

Hi

I had a form, with multiple image input types. My html


...etc
worked fine in Firefox, but Internet Explorer won't do it. It doesn't send
the values.
In fact it doesn't seem to send anything from image type form elements,
unless I am missing something. I tried renaming the images so they were
sign1, sign2, etc but nothing - when I use PHP to echo the value of
$_POST['sign1'] I see a value in Firefox for the image I have clicked, but
nothing in IE. It just reloads the page.

My googling has found others who have had similar problems, bit no real
solution - can anyone help me out here?

Thanks

MarkW

Re: IE form image type - not playing nice

am 03.07.2007 14:38:41 von Neredbojias

On Tue, 03 Jul 2007 12:16:19 GMT Marnok.com scribed:

> Hi
>
> I had a form, with multiple image input types. My html
>
>
> ..etc
> worked fine in Firefox, but Internet Explorer won't do it. It doesn't
> send the values.
> In fact it doesn't seem to send anything from image type form
> elements, unless I am missing something. I tried renaming the images
> so they were sign1, sign2, etc but nothing - when I use PHP to echo
> the value of $_POST['sign1'] I see a value in Firefox for the image I
> have clicked, but nothing in IE. It just reloads the page.
>
> My googling has found others who have had similar problems, bit no
> real solution - can anyone help me out here?

You're naming 2 elements the same name. I think ie is right.

--
Neredbojias

Never doubt
The path you've chosen.
If others mock,
Just thumb your nos'n.
- Burma Shave

Re: IE form image type - not playing nice

am 03.07.2007 16:26:24 von Neredbojias

On Tue, 03 Jul 2007 14:39:30 GMT Marnok.com scribed:

>>> I had a form, with multiple image input types. My html
>>>
>>>
>>> ..etc
>>> worked fine in Firefox, but Internet Explorer won't do it. It doesn't
>>> send the values.
>>> In fact it doesn't seem to send anything from image type form
>>> elements, unless I am missing something. I tried renaming the images
>>> so they were sign1, sign2, etc but nothing - when I use PHP to echo
>>> the value of $_POST['sign1'] I see a value in Firefox for the image I
>>> have clicked, but nothing in IE. It just reloads the page.
>>>
>>> My googling has found others who have had similar problems, bit no
>>> real solution - can anyone help me out here?
>>
>> You're naming 2 elements the same name. I think ie is right.
>>
>> --
>> Neredbojias
>
> In the first case yes, but as I say then I gave each individual names
> (sign1, sign2 etc) and I am getting no usable value.

Ya know, that's twice in a month I've misread a post and gave an
inappropriate answer. The reason, I believe, is that I focus on the bit
of included markup or significant few lines and tend to miss the more
embedded stuff.

It may not be your fault that I can't read, but it does show the benefit
of a url, particularly one exclusively delineating the problem. Yes,
it's a form, but a mockup could still be made with the script included as
text on the page. Hell, half the time I've been stuck and starting
preparing a "question", I've found the answer in the very process.

Now, after all that, it's surely related to your form markup, not the
script.

--
Neredbojias

Never doubt
The path you've chosen.
If others mock,
Just thumb your nos'n.
- Burma Shave

Re: IE form image type - not playing nice

am 03.07.2007 16:39:30 von wizardharry

"Neredbojias" wrote in message
news:Xns99623967012EFnanopandaneredbojias@198.186.190.161...
> On Tue, 03 Jul 2007 12:16:19 GMT Marnok.com scribed:
>
>> Hi
>>
>> I had a form, with multiple image input types. My html
>>
>>
>> ..etc
>> worked fine in Firefox, but Internet Explorer won't do it. It doesn't
>> send the values.
>> In fact it doesn't seem to send anything from image type form
>> elements, unless I am missing something. I tried renaming the images
>> so they were sign1, sign2, etc but nothing - when I use PHP to echo
>> the value of $_POST['sign1'] I see a value in Firefox for the image I
>> have clicked, but nothing in IE. It just reloads the page.
>>
>> My googling has found others who have had similar problems, bit no
>> real solution - can anyone help me out here?
>
> You're naming 2 elements the same name. I think ie is right.
>
> --
> Neredbojias

In the first case yes, but as I say then I gave each individual names
(sign1, sign2 etc) and I am getting no usable value.

Re: IE form image type - not playing nice

am 03.07.2007 18:08:06 von wizardharry

"Neredbojias" wrote in message
news:Xns99624BAFE5639nanopandaneredbojias@198.186.190.161...
> On Tue, 03 Jul 2007 14:39:30 GMT Marnok.com scribed:
>
>>>> I had a form, with multiple image input types. My html
>>>>
>>>>
>>>> ..etc
>>>> worked fine in Firefox, but Internet Explorer won't do it. It doesn't
>>>> send the values.
>>>> In fact it doesn't seem to send anything from image type form
>>>> elements, unless I am missing something. I tried renaming the images
>>>> so they were sign1, sign2, etc but nothing - when I use PHP to echo
>>>> the value of $_POST['sign1'] I see a value in Firefox for the image I
>>>> have clicked, but nothing in IE. It just reloads the page.
>>>>
>>>> My googling has found others who have had similar problems, bit no
>>>> real solution - can anyone help me out here?
>>>
>>> You're naming 2 elements the same name. I think ie is right.
>>>
>>> --
>>> Neredbojias
>>
>> In the first case yes, but as I say then I gave each individual names
>> (sign1, sign2 etc) and I am getting no usable value.
>
> Ya know, that's twice in a month I've misread a post and gave an
> inappropriate answer. The reason, I believe, is that I focus on the bit
> of included markup or significant few lines and tend to miss the more
> embedded stuff.
>
> It may not be your fault that I can't read, but it does show the benefit
> of a url, particularly one exclusively delineating the problem. Yes,
> it's a form, but a mockup could still be made with the script included as
> text on the page. Hell, half the time I've been stuck and starting
> preparing a "question", I've found the answer in the very process.
>
> Now, after all that, it's surely related to your form markup, not the
> script.
>
> --
> Neredbojias
>

Hi

I've created a simple cut-down test:

http://www.marnok.com/test/test.php

What I see in Firefox, I click an image, and a "1" is displayed in the echo
related to that image.
When I try the same in Internet Explorer, I get nothing.

I'd appreciate any advice on what I am doing wrong here.

Re: IE form image type - not playing nice

am 03.07.2007 20:07:36 von Bergamot

Marnok.com wrote:
>
> http://www.marnok.com/test/test.php
>
> What I see in Firefox, I click an image, and a "1" is displayed in the echo
> related to that image.
> When I try the same in Internet Explorer, I get nothing.

This looks like one of those rare cases where IE isn't doing anything wrong.

> I'd appreciate any advice on what I am doing wrong here.

You are using inappropriately. Read the specs at
http://www.w3.org/TR/html401/interact/forms.html#h-17.4 to learn why.

You probably want a button element instead, but ISTM that IE has other
problems with that.

--
Berg

Re: IE form image type - not playing nice

am 04.07.2007 10:58:59 von wizardharry

"Bergamot" wrote in message
news:5evhkaF3a7pa4U1@mid.individual.net...
> Marnok.com wrote:
>>
>> http://www.marnok.com/test/test.php
>>
>> What I see in Firefox, I click an image, and a "1" is displayed in the
>> echo
>> related to that image.
>> When I try the same in Internet Explorer, I get nothing.
>
> This looks like one of those rare cases where IE isn't doing anything
> wrong.
>
>> I'd appreciate any advice on what I am doing wrong here.
>
> You are using inappropriately. Read the specs at
> http://www.w3.org/TR/html401/interact/forms.html#h-17.4 to learn why.
>
> You probably want a button element instead, but ISTM that IE has other
> problems with that.
>
> --
> Berg

Hi,

Slow Kid here again...
Thanks Bergamot and Neredbojias for you help on this.

I tried buttons as you suggest,

http://www.marnok.com/test/test2.php

now this also works as expected in Firefox, sending a value of "1" for the
button which was pressed.
In IE, it seems to send a messed-up version of the path to the image instead
(putting quotes around the actual file path/name specified in the html), and
sends it for BOTH buttons regardless of which is pressed.

I think I may have to change direction, maybe dump the form and go with
image links with "?button=n" for each. Probably simpler anyway.

But I would be interested to know if anyone can tell me, is there anything
else I could have done to make this work as a form in IE?

Re: IE form image type - not playing nice

am 04.07.2007 11:56:39 von Neredbojias

On Wed, 04 Jul 2007 08:58:59 GMT Marnok.com scribed:

>> You probably want a button element instead, but ISTM that IE has
>> other problems with that.
>>
>> --
>> Berg
>
> Hi,
>
> Slow Kid here again...
> Thanks Bergamot and Neredbojias for you help on this.
>
> I tried buttons as you suggest,
>
> http://www.marnok.com/test/test2.php
>
> now this also works as expected in Firefox, sending a value of "1" for
> the button which was pressed.
> In IE, it seems to send a messed-up version of the path to the image
> instead (putting quotes around the actual file path/name specified in
> the html), and sends it for BOTH buttons regardless of which is
> pressed.
>
> I think I may have to change direction, maybe dump the form and go
> with image links with "?button=n" for each. Probably simpler anyway.
>
> But I would be interested to know if anyone can tell me, is there
> anything else I could have done to make this work as a form in IE?

I dunno. I copied your source and images, uploaded them to my server,
played around with the markup some, and got exactly the same results you
did. Apparently ie is "interpreting" the value of the post variable(s)
as content instead of "value". Somebody real good with forms might have
a solution but that isn't me.

--
Neredbojias

Never doubt
The path you've chosen.
If others mock,
Just thumb your nos'n.
- Burma Shave

Re: IE form image type - not playing nice

am 05.07.2007 23:37:21 von jkorpela

Scripsit Bergamot:

> Marnok.com wrote:
>>
>> http://www.marnok.com/test/test.php
>>
>> What I see in Firefox, I click an image, and a "1" is displayed in
>> the echo related to that image.
>> When I try the same in Internet Explorer, I get nothing.
>
> This looks like one of those rare cases where IE isn't doing anything
> wrong.

Yes, though somewhat debatably. A browser is expected to send the x and y
coordinates of the clicked location (this is explicitly stated in the
specifications), but it can be argued that it could, or maybe even should,
_also_ send the name=value pair.

The bottom line is, anyway, that you can't count on getting anything but the
coordinates. You might still find out which button was used, if you use
different name="..." attributes for them. Authors just often get confused
with the ways in which some server-side technologies work with the
coordinate information. More info:
http://www.cs.tut.fi/~jkorpela/forms/imagebutton.html

> You probably want a button element instead, but ISTM that IE has other
> problems with that.

It surely has.

It puzzles me why authors take great pains in their efforts to create
problems with image submit buttons, instead of the apparent method of using
normal submit buttons.

Ultimately, in most cases, you simply cannot count on being able to detect
which button was used to submit the form. If the form contains a text input
field, as it usually does, then there's really no way to prevent users from
typing in something there and pressing the enter key. And so the form
submits - without using _any_ of the submit buttons.

Thus, it is usually best to design a form so that all choices are made
before using a submit button, instead of leaving one decision to be made by
choosing among two or more submit buttons. You would then have just one
submit button.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/