Topic: Radio buttons in XHTML Pages that link to <a href="https://ozoneasylum.com/backlink?for=9561" title="Pages that link to Topic: Radio buttons in XHTML" rel="nofollow" >Topic: Radio buttons in XHTML\

 
Author Thread
Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

IP logged posted posted 11-23-2002 21:58 Edit Quote

In HTML 4, when you wanted to have some radio buttons, you'd do this...

<input type="radio" name="choice" value="a"> a
<input type="radio" name="choice" value="b"> b
<input type="radio" name="choice" value="c"> c

And since they all have the same name, you could only choose one of them.

But in XHTML, two elements can't have the same ID.

So... how do you group radio buttons all together?

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

IP logged posted posted 11-23-2002 23:25 Edit Quote

Ok, stupid question - only one element can have the same id, but aren't id and name totally seperate entities?



Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

IP logged posted posted 11-23-2002 23:51 Edit Quote

Hmm. I thought that name was deprecated in favor of ID.

Maybe name is still supported for radio buttons? Or even all form elements?

I never really understood what happened to name.

Perfect Thunder
Paranoid (IV) Inmate

From: Milwaukee
Insane since: Oct 2001

IP logged posted posted 11-24-2002 03:31 Edit Quote

As far as I know, "name" is the variable that gets passed via GET or POST, while "id" is the DOM handle. So you could have several things with the same name, if you wanted them to pass the same variable, but you could give them different IDs for dHTML purposes.

This is just off the top of my head, though.

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

IP logged posted posted 11-24-2002 06:28 Edit Quote

I think it depends on the DOCTYPE you're using. Using the transitional DOCTYPE, this validates correctly:

code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title>::: Pugzly Code :::</title>
</head>
<body>
<form name="blah" action="" method="post">
<input type="radio" name="crap" value="1" />
<input type="radio" name="crap" value="2" />
<input type="radio" name="crap" value="3" />
<input type="radio" name="crap" value="4" />
</form>
</body>
</html>



Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

IP logged posted posted 11-24-2002 07:16 Edit Quote

Well, I'm looking for the strict XHTML doctype to work =)

(I haven't tried it myself. I'll do that. Tomorrow. Maybe.)

HZR
Bipolar (III) Inmate

From: Cold Sweden
Insane since: Jul 2002

IP logged posted posted 11-24-2002 11:55 Edit Quote

As far as I know, the name attribute for anchors, images and so on is deprecated in XHTML (maybe even gone in XHTML 1.1) - id shall be used instead. The name attribue for inputs is not deprecated though.



[This message has been edited by HZR (edited 11-24-2002).]



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu