Differences in form handling btw Mozilla and IE?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nicolas Keller

    Differences in form handling btw Mozilla and IE?

    Hi!

    I'm used to have Mozilla for testing my PHP sites when I'm coding. The
    site's nearly finished, now I've made a test with the Internet
    Exlporer... guess what... failed.

    The problem: I'm using a form that submit's (POST) its data via three
    different image buttons (depending on which button you click,
    something different should happen):

    <form action="id.php" method="post" name="form2">
    <input name="id1" type="image" id="id1" value="id1" src="id1.gif">
    <input name="id2" type="image" id="id2" value="id2" src="id2.gif">
    <input name="id3" type="image" id="id3" value="id3" src="id3.gif">
    </form>

    (This is kind of a summary of the code!)

    Now while with Mozilla everything works perfect, the Internet Explorer
    can't handle this: Not one of the variables id1, id2 or id3 is set in
    the target script - but it is in Mozilla. Any solutions / workarounds?
    I have several hidden fields in the original source, so I don't want
    to use URL variables.

    -- Nicolas
  • Jochen Daum

    #2
    Re: Differences in form handling btw Mozilla and IE?

    Hi Nicolas!

    On 19 Feb 2004 08:44:10 -0800, nicolas.keller@ slb.de (Nicolas Keller)
    wrote:
    [color=blue]
    >Hi!
    >
    >I'm used to have Mozilla for testing my PHP sites when I'm coding. The
    >site's nearly finished, now I've made a test with the Internet
    >Exlporer... guess what... failed.
    >
    >The problem: I'm using a form that submit's (POST) its data via three
    >different image buttons (depending on which button you click,
    >something different should happen):
    >
    ><form action="id.php" method="post" name="form2">
    ><input name="id1" type="image" id="id1" value="id1" src="id1.gif">
    ><input name="id2" type="image" id="id2" value="id2" src="id2.gif">
    ><input name="id3" type="image" id="id3" value="id3" src="id3.gif">
    ></form>
    >
    >(This is kind of a summary of the code!)
    >
    >Now while with Mozilla everything works perfect, the Internet Explorer
    >can't handle this: Not one of the variables id1, id2 or id3 is set in
    >the target script - but it is in Mozilla. Any solutions / workarounds?
    >I have several hidden fields in the original source, so I don't want
    >to use URL variables.[/color]

    It sets id1.x and id1.y

    HTH, Jochen
    [color=blue]
    >
    >-- Nicolas[/color]

    --
    Jochen Daum - Cabletalk Group Ltd.
    PHP DB Edit Toolkit -- PHP scripts for building
    database editing interfaces.
    Download PHP DB Edit Toolkit for free. PHP DB Edit Toolkit is a set of PHP classes makes the generation of database edit interfaces easier and faster. The main class builds tabular and form views based on a data dictionary and takes over handling of insert/update/delete and user input.

    Comment

    • Nicolas Keller

      #3
      Re: Differences in form handling btw Mozilla and IE?

      > It sets id1.x and id1.y[color=blue]
      >
      > HTH, Jochen[/color]

      That was the point *phew* In fact, both browsers set the variables
      $varname_x and $varname_y , only Mozilla adds the third variable
      $varname - the one I used.

      Thanks god it was that easy and thanks Jochen! :-)

      -- Nicolas

      Comment

      • John Dunlop

        #4
        Image submit buttons and form data set

        (Note crosspost and follow-ups to ciwah.)

        Nicolas Keller wrote in thread "Difference s in form handling btw
        Mozilla and IE?":
        [color=blue]
        > The problem: I'm using a form that submit's (POST) its data via three
        > different image buttons (depending on which button you click,
        > something different should happen):
        >
        > <form action="id.php" method="post" name="form2">
        > <input name="id1" type="image" id="id1" value="id1" src="id1.gif">
        > <input name="id2" type="image" id="id2" value="id2" src="id2.gif">
        > <input name="id3" type="image" id="id3" value="id3" src="id3.gif">
        > </form>
        >
        > (This is kind of a summary of the code!)[/color]

        Eh, since I've moved this discussion to ciwah, I'll question whether
        that summary involved removing alt attributes. :-)
        [color=blue]
        > Now while with Mozilla everything works perfect, the Internet Explorer
        > can't handle this: Not one of the variables id1, id2 or id3 is set in
        > the target script - but it is in Mozilla.[/color]

        My interpretation of the HTML4.01 specification leads me to believe
        that Internet Explorer behaves incorrectly [1]. The INPUT that's
        used to submit a form *is* a successful control, which, by HTML
        rules, means its control-name/current-value pair is included as part
        of the form data set: "Every successful control has its control name
        paired with its current value as part of the submitted form data set"
        (HTML4.01, sec. 17.13.2).

        By searching for previous comments, I came across:


        J. Korpela says "the value of the VALUE attribute is ignored, and the
        coordinates of the clicked location are passed instead". I can't
        find where this is written in the specification. Section 17.4.1
        states:

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

        So, the submitted data *includes* the coordinates of where the
        pointing device was when it was used to submit the form [2]; the
        spec. does not say the control-name/current-value pair of the image
        submit button is not also included as part of the form data set. J.
        Korpela then goes on to say that whether this information should be
        included "is somewhat debatable and depends on the interpretation of
        wordings in the specification". I cannot see why this is the case.

        In the thread <http://groups.google.c om/groups?th=e5f4d c91c1b1eda2>,
        linked to by the above document, it's explained why an image submit
        button's control-name/current-value pair should be submitted as part
        of the form data set, and why browsers not doing so are in violation
        of the specification. I agree with this conclusion.

        On the other hand, A. Flavell's document:

        says that "it would be unwise to try to rely on this behaviour, as
        it's not in the specifications" .

        I'm confused. Is my interpretation wrong?


        [1] What makes me think twice are the browsers that don't behave in
        accordance with my interpretation (among others, no doubt): Opera
        7.10, Opera 6.0, Opera 5.12, IE 6.0, Netscape 4.74.

        [2] The exact words of the specification are: "When a pointing device
        is used to click on the image...". Is there any reason why a
        pointing device *must* click to activate something?

        --
        Jock

        Comment

        Working...