Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to allow only one radio button to be checked?

Tags:

html

forms

django

Simply give them the same name:

<input type="radio" name="radAnswer" />

They need to all have the same name.


All radio buttons have to have the same name:

<input type='radio' name='foo'>

Only 1 radio button of each group of buttons with the same name can be checked.


Give them the same name, and it will work. By definition Radio buttons will only have one choice, while check boxes can have many.

<input type="radio" name="Radio1" />