|
Posted by Brian Staff on 11/29/05 17:16
> (1) Can two HTML controls have the same name? It looks like the obvious
> answer is NO.
Yes they can, for instance, two radio buttons can (should) have the same NAME but
they must (should) have a unique ID.
> (2) What if? What if the developer has given two HTML controls the same
> name, i.e has created the same button more than once with exactly the
> same name and all other attributes? What happens then?
The NAME is only used when a FORM and its child controls are sent back to the
server. The server identifies each control thru its NAME. If the server is not
interested in the value(s) of the controls with the same name, then it does not
matter.
JavaScript on the client-side though typically uses the ID (which should be
unique), but if an ID is not specified, then it will use the NAME.
Brian
Navigation:
[Reply to this message]
|