Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Re: Input element duplicate names?

Reply
Thread Tools

Re: Input element duplicate names?

 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      02-28-2009
Ed Jay wrote:

> Bad or OK...more than one input element with same name,
> but in different forms?


Each form has its own set of fields ("controls"), so you can use the same
name in different forms.

A page may contain any number of forms, but at least a well-designed page
normally has at most one.

> Example:
>
> <form name = "form1"....>
> <input name = "joe"...>
> </form>
>
> <form name = "form2"....>
> <input name = "joe"...>
> </form>


That's not valid in HTML 4.01, which does not allow a name="..." attribute
for a form. (Use id="..." instead and modify your Javascript code
accordingly.) But this is a different issue.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

 
Reply With Quote
 
 
 
 
Eric Bednarz
Guest
Posts: n/a
 
      02-28-2009
"Jukka K. Korpela" <> writes:

>> <form name = "form1"....>


[…]

> That's not valid in HTML 4.01, which does not allow a name="..."
> attribute for a form.


I think you are confusing that with HTML 4.0, or maybe XHTML 1.0.

> (Use id="..." instead and modify your Javascript
> code accordingly.)


What script? I didn’t see any. Anyway, name or id shouldn’t really
matter since you can use both to identify the form element node in the
document.forms collection.
 
Reply With Quote
 
 
 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      03-01-2009
Eric Bednarz wrote:

> "Jukka K. Korpela" <> writes:
>
>>> <form name = "form1"....>

>
> […]
>
>> That's not valid in HTML 4.01, which does not allow a name="..."
>> attribute for a form.

>
> I think you are confusing that with HTML 4.0, or maybe XHTML 1.0.


Indeed I was confusing HTML 4.01 with HTML 4.0 here. Yet, the name="..."
attribute is illogical for a <form> element, since this is not about naming
but identification. And the HTML 4.01 spec says:
"Note. This attribute has been included for backwards compatibility.
Applications should use the id attribute to identify elements."
(This applies to name="..." for <form>. Many people have misinterpreted that
it also applies to form fields, but in them, the attribute has a different
meaning and there it is indispensable.)

>> (Use id="..." instead and modify your Javascript
>> code accordingly.)

>
> What script? I didn’t see any.


Lost your crystal ball? I think it's easy to see that when people use <form
name="..." ...>, they do so for scripting. The HTML 4.01 spec says, in the
summary of attributes; "name of form for scripting".

--
Yucca, http://www.cs.tut.fi/~jkorpela/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Input element duplicate names? Harlan Messinger HTML 1 02-28-2009 12:11 PM
how to Update/insert an xml element's text----> (<element>text</element>) HANM XML 2 01-29-2008 03:31 PM
detect duplicate element in SAX usgog@yahoo.com XML 2 09-25-2006 01:09 AM
XML schema: duplicate element occurences John Jørgensen XML 2 07-09-2004 09:11 AM
About schema : duplicate element definition or reference cr XML 0 08-08-2003 03:25 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57