Form <inpu> name & id required?

Discussion in 'HTML' started by Caversham, Jun 25, 2005.

  1. Caversham

    Caversham Guest

    I notice that Dreamweaver automatically adds both name and id
    attributes to form input tags. Are both of these required? Is there
    some recommendation both should be used?

    Caversham
     
    Caversham, Jun 25, 2005
    #1
    1. Advertising

  2. Caversham

    Lachlan Hunt Guest

    Caversham wrote:
    > I notice that Dreamweaver automatically adds both name and id
    > attributes to form input tags. Are both of these required? Is there
    > some recommendation both should be used?


    The name attribute is used when submitting the name=value pairs. The id
    attribute is useful for referencing from other places, such as with the
    for attribute in the label element, with scripts by using
    getElementById(), with stylesheets using the ID selector, etc. Neither
    of them are required.


    --
    Lachlan Hunt
    http://lachy.id.au/
    http://GetFirefox.com/ Rediscover the Web
    http://GetThunderbird.com/ Reclaim your Inbox
     
    Lachlan Hunt, Jun 25, 2005
    #2
    1. Advertising

  3. Caversham wrote:

    > I notice that Dreamweaver automatically adds both name and id
    > attributes to form input tags. Are both of these required? Is there
    > some recommendation both should be used?
    >
    > Caversham
    >

    name is for backward compatibility with legacy browsers, like NN4x.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Jun 25, 2005
    #3
  4. Caversham

    Mitja Guest

    On Sat, 25 Jun 2005 03:18:02 +0200, Jonathan N. Little
    <> wrote:

    > Caversham wrote:
    >
    >> I notice that Dreamweaver automatically adds both name and id
    >> attributes to form input tags. Are both of these required? Is there
    >> some recommendation both should be used?
    >> Caversham
    >>

    > name is for backward compatibility with legacy browsers, like NN4x.
    >

    Not for form elements. Try
    <form ...>
    <input type="text" id="foo" value="bar"> <input type="submit">
    </form>
    and see if it works :)
    ID and name have different semantics and uses, like Lachlan explained.
     
    Mitja, Jun 25, 2005
    #4
  5. Caversham

    RobG Guest

    Mitja wrote:
    > On Sat, 25 Jun 2005 03:18:02 +0200, Jonathan N. Little
    > <> wrote:
    >
    >> Caversham wrote:
    >>
    >>> I notice that Dreamweaver automatically adds both name and id
    >>> attributes to form input tags. Are both of these required? Is there
    >>> some recommendation both should be used?
    >>> Caversham
    >>>

    >> name is for backward compatibility with legacy browsers, like NN4x.
    >>

    > Not for form elements. Try
    > <form ...>
    > <input type="text" id="foo" value="bar"> <input type="submit">
    > </form>
    > and see if it works :)
    > ID and name have different semantics and uses, like Lachlan explained.


    Input & name:
    <URL:http://www.w3.org/TR/html4/interact/forms.html#adef-name-INPUT>
    <URL:http://www.w3.org/TR/html4/interact/forms.html#control-name>

    ID:
    <URL:http://www.w3.org/TR/html4/struct/global.html#adef-id>

    HTML attributes:
    <URL:http://www.w3.org/TR/html4/index/attributes.html>



    --
    Rob
     
    RobG, Jun 27, 2005
    #5
    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. Just D.
    Replies:
    0
    Views:
    464
    Just D.
    Mar 10, 2006
  2. Replies:
    1
    Views:
    133
  3. Java  script  Dude

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

    Java script Dude, Jun 29, 2004, in forum: Javascript
    Replies:
    5
    Views:
    283
    Java script Dude
    Jun 30, 2004
  4. Pavils Jurjans
    Replies:
    3
    Views:
    235
    Pavils Jurjans
    Mar 18, 2005
  5. Replies:
    6
    Views:
    211
Loading...

Share This Page