in reply to CGI and xhtml

I think you are confusing internal fragment identifiers which must indeed be set with the id attribute with the perfectly legitimate name attribute on the <input> element - please see the XHTML DTD if you need confirmation of this.

/J\

Replies are listed 'Best First'.
Re^2: cgi-bin and xhtml
by jbrugger (Parson) on Mar 22, 2005 at 15:28 UTC
    Is it? <form action="/cgi-bin/script.pl..." method="post" name="LoginForm"> is not Valid XHTML 1.0 Strict
    I use multiple forms, where i have checked the name of a submitted form to perform an certin action (and the elements in the different forms might even be the same)
    update
    But indeed, name for an input type works fine.
    "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.

      That's the form name, which is only used by client side script (i.e. it is never used by server side script). That should be an id (which can them be referenced by JavaScript in the document.forms collection just like the old name attribute).

      It is form controls (like input, select and textarea) that need names. (Its also a good idea to give them ids so you can reference them with label elements, but the ids and names do not have to be the same.)

        (Its also a good idea to give them ids so you can reference them with label elements, but the ids and names do not have to be the same.)

        and, to make things even more confusing -- ids need to be unique through the page, but names don't.

        It makes sense, when you think about it in terms of items that repeat, such as checkboxes or radio buttons, but you might also have more than one form on the page, which contains elements that overlap names ... but you can't duplicate ids. (well, you can, but not if you want it to be valid)

      Er, I don't see anywhere I mention the <form> element - I refer explicitly to the <input> element.

      /J\

        Thanks.. found it:
        <!ENTITY % InputType "(text | password | checkbox | radio | submit | reset | file | hidden | image | button)" > <!-- the name attribute is required for all but submit & reset -->
        Think i wasn't reading properly.
        (i only have to do something about the forms then, but i'll find a way.
        "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.