I want to check multiple radio buttons, all radio buttons having same name but different ids.
Here is my html code,
<span style="float:left;margin:0 0 0 10px">Proactivity</span>
<label for="q11" style="width:auto;margin:0 60px 0 0;padding:0;"><input type="radio" id="qq[]" class="styled" value="Proactivity > Poor" name="q11[]">Poor</label>
<label for="q11" style="width:auto;margin:0 18px 0 0;padding:0;"><input type="radio" id="qqa[]" class="styled" value="Proactivity > Good" name="q11[]">Good</label>
<br/><br/>
<span style="float:left;margin:0 0 0 10px">Service/support</span>
<label for="q11" style="width:auto;margin:0 60px 0 0;padding:0;"><input type="radio" id="qq[]" class="styled" value="Service/support > Poor" name="q11[]">Poor</label>
<label for="q11" style="width:auto;margin:0 18px 0 0;padding:0;"><input type="radio" id="qqa[]" class="styled" value="Service/support > Good" name="q11[]">Good</label>
<br/><br/>
<span style="float:left;margin:0 0 0 10px">Provision of <br />specialist skills</span>
<label for="q11" style="width:auto;margin:0 60px 0 0;padding:0;"><input type="radio" id="qq[]" class="styled" value="Provision of specialist skills > Poor" name="q11[]">Poor</label>
<label for="q11" style="width:auto;margin:0 18px 0 0;padding:0;"><input type="radio" id="qqa[]" class="styled" value="Provision of specialist skills > Good" name="q11[]">Good</label>
You can't. Radio buttons are there for a single choice. For multiple choices, you need checkboxes.
Wrapping your radio buttons in the form tag will allow for groups of radio buttons with the same name to function independently from each other.
http://jsfiddle.net/8qB56/
But looking at what you are trying to do, it is more appropriate for you to change the input name of each logical question, since you are working with what looks like a single form.
So perhaps you can change name="q11[]"
to name="q11[proactivity]"
for the proactivity question inputs, name="q11[service]"
for the service question inputs, and name="q11[provision]"
for the provision question inputs.
Doing this will allow all the selected responses from these inputs to stay in the q11 field on the server side, you can then massage the data however you want (I'm assuming q11 stands for "question 11" or something so that's why you are so insistant on keeping the same name for all these inputs).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With