checkbox and select menu

is there a way to
have a 3 checkboxes and one select menu
with the same name

so when select menu is selected, there is no need to put a checkbox next to it
Who is Participating?
jameso99Connect With a Mentor Commented:
This is not guaranteed to work in all browser and should be reviewed, but it was something I could whip up to show you an example of how you can use a select box to check checkboxes.

<script type="text/javascript">
function selectBoxes() {
  var x1 = document.getElementById('mySelectBox');
  var x2 = x1.options[x1.selectedIndex].value;
  if (x2 == "all") {
    for (i=0; i<document.test.checkgroup.length; i++) {
      document.test.checkgroup[i].checked = true;
  else {
    for (i=0; i<document.test.checkgroup.length; i++) {
      document.test.checkgroup[i].checked = false;

<form name="test">
<select id="mySelectBox" onChange="selectBoxes();">
<option value="">-- Select --</option>
<option value="all">Select All</option>
<input type="checkbox" name="checkgroup" />A
<input type="checkbox" name="checkgroup" />B
<input type="checkbox" name="checkgroup" />C

Open in new window

They wouldn't need to have the same name, but you could use Javascript to check the box when the select field is selected.  For this each field needs its own ID value, and then the script would have to know which checkboxes are associated with the select field.
rgb192Author Commented:
I dont understand
Greg AlexanderLead DeveloperCommented:
No there is not, the post object would get overwritten so there would always only be the select menu's value being submitted.
rgb192Author Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.