Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > IE form image type - not playing nice

Reply
Thread Tools

IE form image type - not playing nice

 
 
Marnok.com
Guest
Posts: n/a
 
      07-03-2007
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


 
Reply With Quote
 
 
 
 
Neredbojias
Guest
Posts: n/a
 
      07-03-2007
On Tue, 03 Jul 2007 12:16:19 GMT Marnok.com scribed:

> 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
 
Reply With Quote
 
 
 
 
Neredbojias
Guest
Posts: n/a
 
      07-03-2007
On Tue, 03 Jul 2007 14:39:30 GMT Marnok.com scribed:

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

>
> 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
 
Reply With Quote
 
Marnok.com
Guest
Posts: n/a
 
      07-03-2007

"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
>> <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


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.


 
Reply With Quote
 
Marnok.com
Guest
Posts: n/a
 
      07-03-2007

"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
>>>> <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

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


 
Reply With Quote
 
Bergamot
Guest
Posts: n/a
 
      07-03-2007
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 <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.

--
Berg
 
Reply With Quote
 
Marnok.com
Guest
Posts: n/a
 
      07-04-2007

"Bergamot" <> wrote in message
news:...
> 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 <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.
>
> --
> 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?



 
Reply With Quote
 
Neredbojias
Guest
Posts: n/a
 
      07-04-2007
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
 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      07-05-2007
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/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
logitech setpoint not playing nice marty Windows 64bit 1 01-06-2006 03:51 PM
Bookmarks not playing nice MEow Firefox 2 12-21-2004 04:48 PM
ASP.NET and SQL 2000 not playing nice? Hugh G. Johnson ASP .Net 3 09-07-2004 08:08 AM
homebrew 2.3 install on RedHat9 not playing nice with Tkinter Rob Andrews Python 3 09-01-2003 08:34 AM
Fwd: Re: homebrew 2.3 install on RedHat9 not playing nice with Tkinter Martin Franklin Python 0 08-28-2003 08:45 AM



Advertisments