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
LVL 1
rgb192Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jameso99Commented:
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.
0
rgb192Author Commented:
I dont understand
0
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.
0
jameso99Commented:
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;
    }
  }
}
</script>

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

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rgb192Author Commented:
thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.