IE name="name" & form.name property bug

Discussion in 'Javascript' started by Java script Dude, Jun 29, 2004.

  1. We just discovered another IE bug.

    When an html form contains an element with a name of `name` IE's
    internal index screws up the .name property of the containing form to
    point to the bad element object instead of containing the string name
    property of the form.

    Here is the simplified test case:

    <html>
    <head>
    <title>IE Name="name" Bug</title>
    <script>
    function showFormName(){
    alert(
    "Text should say `fmTest`~~~> "+
    oF["good_name"].form.name+"\n\n"+
    "Second test: Test .value prop~~> "+
    oF["good_name"].form.name.value
    )
    }
    </script>
    </head>
    <body>
    <form name="fmTest">
    <script>oF=document.forms["fmTest"]</script>
    Good:
    <input type=text name="good_name" value="Good Elem Name">
    <script>showFormName()</script>
    Bad:
    <input type=text name="name" value="Bad Elem Name">
    <script>showFormName()</script>
    </form>
    </body>
    </html>

    Probably not a good idea to use just `name` anyway `tbName` or similar
    is better coding practice any how. We are customizing a system that
    uses form element names that match attribute names in our business
    object server. `name` is actually the core business object `name`
    attribute. We are working around by customizing the TCL core code to
    look for obj_name instead.

    JsD
    Java script Dude, Jun 29, 2004
    #1
    1. Advertising

  2. Java script Dude wrote:
    > We just discovered another IE bug.


    It isn't necessarily a bug and it certainly isn't restricted to IE.

    > When an html form contains an element with a name of `name` IE's
    > internal index screws up the .name property of the containing form to
    > point to the bad element object instead of containing the string name
    > property of the form.

    <snip>

    "The Most Common Mistake":-

    <URL: http://jibbering.com/faq_notes/form_access.html#faComMis >

    Richard.
    Richard Cornford, Jun 29, 2004
    #2
    1. Advertising

  3. Java  script  Dude

    Randy Webb Guest

    Randy Webb, Jun 29, 2004
    #3
  4. Java  script  Dude

    Randy Webb Guest

    Randy Webb, Jun 29, 2004
    #4
  5. Richard Cornford, Jun 29, 2004
    #5
  6. Java script Dude, Jun 30, 2004
    #6
    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. Eric Newton
    Replies:
    3
    Views:
    9,377
    Brock Allen
    Apr 4, 2005
  2. Ronaldo N
    Replies:
    1
    Views:
    101
    Martin Honnen
    May 10, 2004
  3. Pavils Jurjans
    Replies:
    3
    Views:
    180
    Pavils Jurjans
    Mar 18, 2005
  4. Replies:
    6
    Views:
    161
  5. Bosconian
    Replies:
    4
    Views:
    397
    Bosconian
    Dec 3, 2006
Loading...

Share This Page