IE form image type - not playing nice

Discussion in 'HTML' started by Marnok.com, Jul 3, 2007.

  1. Marnok.com

    Marnok.com Guest

    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
     
    Marnok.com, Jul 3, 2007
    #1
    1. Advertising

  2. Marnok.com

    Neredbojias Guest

    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
     
    Neredbojias, Jul 3, 2007
    #2
    1. Advertising

  3. Marnok.com

    Neredbojias Guest

    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
     
    Neredbojias, Jul 3, 2007
    #3
  4. Marnok.com

    Marnok.com Guest

    "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.
     
    Marnok.com, Jul 3, 2007
    #4
  5. Marnok.com

    Marnok.com Guest

    "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.
     
    Marnok.com, Jul 3, 2007
    #5
  6. Marnok.com

    Bergamot Guest

    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
     
    Bergamot, Jul 3, 2007
    #6
  7. Marnok.com

    Marnok.com Guest

    "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?
     
    Marnok.com, Jul 4, 2007
    #7
  8. Marnok.com

    Neredbojias Guest

    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
     
    Neredbojias, Jul 4, 2007
    #8
  9. 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/
     
    Jukka K. Korpela, Jul 5, 2007
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hugh G. Johnson

    ASP.NET and SQL 2000 not playing nice?

    Hugh G. Johnson, Sep 6, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    531
    Hans Kesting
    Sep 7, 2004
  2. Rob Andrews
    Replies:
    3
    Views:
    414
    Martin Franklin
    Sep 1, 2003
  3. Martin Franklin
    Replies:
    0
    Views:
    430
    Martin Franklin
    Aug 28, 2003
  4. fochie
    Replies:
    0
    Views:
    336
    fochie
    Feb 1, 2005
  5. Roy Smith
    Replies:
    1
    Views:
    143
    Roy Smith
    Mar 30, 2013
Loading...

Share This Page