如何设置只能检查一个单选按钮 [英] how to set that only one radio button can be checked

查看:132
本文介绍了如何设置只能检查一个单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

{% for each in AnswerQuery %}
<form action={{address}}>
<span>{{each.answer}}</span><input type='radio'>
<span>Votes:{{each.answercount}}</span>
<br>
</form>
{% endfor %}

这是我的django模板的一部分,它应该是做的是打印出对应于分配到按钮的答案几个单选按钮。但我不知道为什么,我可以选中多个单选按钮,它搞砸了我。它应该只让我检查一个单选按钮,我有一些,但我失去了它。任何帮助?谢谢

this is a part my django template, what it supposed to do is to print out several radio button corresponding to the answers assigned to the buttons. But I dont know why that I can check multiple radio buttons, which messed me up. It is supposed to only let me check on one radio button and I had that somehow but I lost it. Any help? Thank you

推荐答案

只需给他们相同的名称:

Simply give them the same name:

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

这篇关于如何设置只能检查一个单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆