IE form image type - not playing nice

M

Marnok.com

Hi

I had a form, with multiple image input types. My html
<input name="sign" type=image src="1.jpg" value="1" >
<input name="sign" type=image src="2.jpg" value="2" >
...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
 
N

Neredbojias

Hi

I had a form, with multiple image input types. My html
<input name="sign" type=image src="1.jpg" value="1" >
<input name="sign" type=image src="2.jpg" value="2" >
..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
 
N

Neredbojias

I had a form, with multiple image input types. My html
<input name="sign" type=image src="1.jpg" value="1" >
<input name="sign" type=image src="2.jpg" value="2" >
..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.

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
 
M

Marnok.com

Neredbojias said:
Hi

I had a form, with multiple image input types. My html
<input name="sign" type=image src="1.jpg" value="1" >
<input name="sign" type=image src="2.jpg" value="2" >
..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.

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.
 
M

Marnok.com

Neredbojias said:
I had a form, with multiple image input types. My html
<input name="sign" type=image src="1.jpg" value="1" >
<input name="sign" type=image src="2.jpg" value="2" >
..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.

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.

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.
 
B

Bergamot

Marnok.com said:
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 <input type="image"> 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.
 
M

Marnok.com

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


You are using <input type="image"> 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.

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?
 
N

Neredbojias

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
 
J

Jukka K. Korpela

Scripsit Bergamot:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top