Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9132191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:16:10+00:00 2026-06-17T08:16:10+00:00

When the first radio button is selected, I need all three checkboxes to check

  • 0

When the first radio button is selected, I need all three checkboxes to check and disable.

When the second or third radio button other_1 is selected, I need the three checkboxes to uncheck and enable again.

CODE (Non-functioning):

function validate_Days() {

var noOfDays = 0;   

if (document.classic.r.value = "3daypass") {
    noOfDays = 3;
}

if (document.classic.r.value = "2daypass") {
    noOfDays = 2;
}

if (document.classic.r.value = "1daypass") {
    noOfDays = 1;
}


if (noOfDays == 3) {
    document.getElementById('cb1').checked = true;
    document.getElementById('cb2').checked = true;
    document.getElementById('cb3').checked = true;
}
else if (noOfDays == 2) {
    document.getElementById('cb1').checked = false;
    document.getElementById('cb2').checked = false;
    document.getElementById('cb3').checked = false;
}
else if (noOfDays == 1) {
    document.getElementById('cb1').checked = false;
    document.getElementById('cb2').checked = false;
    document.getElementById('cb3').checked = false;
}
}

EDIT: Removed disabling and used more useful names/values

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:16:11+00:00Added an answer on June 17, 2026 at 8:16 am

    I don’t understand what the code is doing, but here is how I would approach checking and unchecking the checkboxes. I also don’t understand why they are disabled when checked – disabled controls can’t be successful so won’t be posted to the server when the form is submitted.

    <script>
    function getRadioValue(radioSet) {
    
      for (var i=0, iLen=radioSet.length; i<iLen; i++) {
    
        if (radioSet[i].checked) {
          return radioSet[i].value;
        }
      }
    }
    
    function updateRadios(el) {
        var form = el.form;
        var checked = getRadioValue(form.rb) == '3'? true : false;
        form.r1.checked = checked;
        form.r2.checked = checked;
        form.r3.checked = checked;
    }
    </script>
    
    <form>
      <fieldset onclick="updateRadios(this)">
         <legend>Radio buttons</legend>
         <input type="radio" value="1" name="rb"> 1<br>
         <input type="radio" value="2" name="rb"> 2<br>
         <input type="radio" value="3" name="rb"> 3<br>
       </fieldset>
       <fieldset>
         <legend>Checkboxes</legend>
         <input type="checkbox" value="1" name="r1"> 1<br>
         <input type="checkbox" value="2" name="r2"> 2<br>
         <input type="checkbox" value="3" name="r3"> 3<br>
       </fieldset>
     </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to set 's:textarea' value which is selected in 's:radio' button. I am
I have a radio button that is the first column of many rows in
I have a table <table> <tr><td><input radio name=R1 onClick=getOtherColumnData()>first</td><td>TR1-TD2</td><td>TR1-TD3</td><td>TR1-TD4</td></tr> <tr><td><input radio name=R1 onClick=getOtherColumnData()>Second</td><td>TR2-TD2</td><td>TR2-TD3</td><td>TR2-TD4</td></tr> <tr><td><input
I have 3 radio button inputs in three separate divs: <div class=box1> <input type=radio
GTK's toggled signal fires when a radio button is selected, but before that, it
I need to have the number of 'yes's' selected from a set of radio
I made a simple form with radio buttons and submit button. On submit, check()
I need to obtain the value of a radio button using javascript I have
I have a Datagrid in Flex. I need to add a radio button in
Hi all i am working on jquery here i have three three radio buttons

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.