troubleshooting Question

Posting disabled checkbox value in ASP

Avatar of geoenvi
geoenvi asked on
JavaScript
12 Comments2 Solutions1098 ViewsLast Modified:
I have two checkboxes chkboxA and chkboxB.
If someone clicks on chkboxA, I need to check the chkboxB and disable it so that chkboxB can be unchecked only by unchecking the chkboxA.  If chkboxA is unchecked then the users are free to check/uncheck the chkboxB. (Code below that works fine to do this.

However, when I try to submit the form in ASP, the disabled chkbox value does not get posted.  I have since understood that ASP does not post disabled values during submit.  What are my options here? Any other way to make the chkbox readonly/disabled from Javascript?




I used the following code that works fine to do this :
******************************************************************************************
function disablechkboxB()
{
    if (document.NewuserForm.chkboxA.checked==true)
    {
   
    document.getElementById('td1').style.color='Gray';
    document.NewuserForm.chkboxB.checked=true;
   document.NewuserForm.chkboxB.readonly=true;
    }
    else
    {
     document.getElementById('td1').style.color='Black';
    document.NewuserForm.chkBoxB.checked=false;
    document.NewuserForm.chkBoxB.disabled=false;
   
    }
    return true;
}
*******************************************************************************************
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 12 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros