选择多个必需复选框

选择多个必需复选框

本文介绍了HTML5 - 选择多个必需复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里写了一些代码:

I've writen some code here: http://jsfiddle.net/anhtran/kXsj9/8/

用户必须在组上至少选择一个选项。但它使我必须点击所有的人提交表格。

Users have to select at least 1 option on the group. But it makes me must click all of them to submit the form. How to do this issue without javascript?

感谢您的帮助:)

推荐答案

我认为这个html5属性只是要定义哪些字段是必需的。
你不能用逻辑来说至少需要一个。

I think this html5 attribute is only supposed to define which fields are required.You cant put logic in to say "at least one is required".

你需要添加自定义javascript才能工作(和/验证服务器端)。

You will need to add custom javascript for this to work (and/or have validation on the server side).

希望这有助于...

这篇关于HTML5 - 选择多个必需复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 17:09