HTML5 - Select multi required-checkbox

anhtran picture anhtran · Jun 2, 2011 · Viewed 7.2k times · Source

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?

Thanks for any help :)

Answer

Marty picture Marty · Jun 2, 2011

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".

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

hope this helps...