Forum Moderators: open

Message Too Old, No Replies

About IDs and XHTML

         

DrDoc

7:21 am on May 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



From [w3.org...]

Section C.8:
The values of these attributes must be unique within the document ..

So, if each ID has to be unique .. What about radio buttons? <input type="radio" ..>
Normally you want a unique name for the radio button group, not for each individual button within the group.

Can someone clarify this for me, or am I just being confused, seeing how it's way past my bedtime right now ;)

Nick_W

7:46 am on May 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, you are a little confused ;)

Use 'name' instead.

<input type="radio" value="apple" name="fruits" />
<input type="radio" value="orange" name="fruits" />
<input type="radio" value="pear" name="fruits" />

No need for id's at all.

Nick

DrDoc

7:50 am on May 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, I'm using names all the time .. But did you go to the page I mentioned? You are, after all, recommended to use the ID and NAME attributes together for now (when dealing with XHTML pages) ..

I guess my question was a bit vague ..

Nick_W

8:47 am on May 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No that's just in URL's

You can't do it in a radio button scenario. If you need to reference the radio buttons for linking then enclose them in a div and give that an id.

Nick