function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Srinivas Reddy Annadi 23Srinivas Reddy Annadi 23 

Inputcheckbox values not stored into Database

I used inputcheckbox functionality to disable the checkboxes based on condition of other checkboxes but when i check the checkbox and click on submit button and it's not stored into database but it is enable from UI side and i used jquery to disable the checkbox values with taking id from inputcheckbox and I used boolean values to disable the checkboxes whenever loading the page.I used actionsupport and it is working very slowly instead of jquery and i need to immediatly disable the checkbox if i click on other checkbox and when i click on submit and it is not storing into database.Can you please help me on this one and it is an urgent issue to fix from my end.

Thanks,
Srinivas
   
    Apex Class :
public class check{
    public boolean abc {get; set;}
    public boolean def {get; set;}
    public boolean ghi {get; set;}
    public boolean jkl {get; set;}
    public boolean mno {get; set;}
    public boolean pqr {get; set;}
    public boolean stu {get; set;}
    public boolean vwx {get; set;} 

public check(){
if(!abc){
disable1();
}
if(!jkl){
disable2();
}
}

public void disable1(){
if(abc){
pqr = false;
stu = false;
vwx = true;
}
else{
pqr = true;
stu = true;
vwx = false;
}
}
public void disable2(){
if(jkl){
mno = true;
pqr = true;
stu = true;
}
else{
mno = false;
pqr = true;
stu = true;
}
}

public void submit () {
if(abc){
aaa.abc__c=true;
}
else {
aaa.abc__c=false;
}
if(def){
aaa.def__c=true;
}
else{
aaa.def__c=false;
}
if(ghi){
aaa.ghi__c=true;
}
else{
aaa.ghi__c=false;
}
if(jkl){
aaa.jkl__c=true;
}
else{
aaa.jkl__c=false;
}
}

vf page :

<apex:pageblocksection>
 <apex:inputCheckbox value="{!abc}" id="abcj" disabled="{!mno}"/>
<apex:inputCheckbox value="{!def}" id="defj" disabled="{!pqr}"/>
<apex:inputCheckbox value="{!ghi}" id="ghij" disabled="{!stu}"/>
<apex:inputCheckbox value="{!jkl}" id="jklj" disabled="{!vwx}"/>
</apex:pageblocksection>

<script>
$(document).ready(function(){
             $("[id$=abcj]").change(function(){
                if(this.checked){
                        $("[id$=jklj]").prop("disabled",true);
                        $("[id$=abcj]").prop("disabled",false);
                        $("[id$=defj]").prop("disabled",false);
                                       
                }
                else{
                      $("[id$=jklj]").prop("disabled",false);
                      $("[id$=abcj]").prop("disabled",true);
                      $("[id$=defj]").prop("disabled",true);
                      $("[id$=abcj]").prop("checked",false);
                      $("[id$=defj]").prop("checked",false);
   
                }              
            });
        }); 

    $(document).ready(function(){
             $("[id$=jklj]").change(function(){
                if(this.checked){
                        $("[id$=abcj]").prop("disabled",true);
                        $("[id$=defj]").prop("disabled",true);
                        $("[id$=ghij]").prop("disabled",true);
                                       
                }
                else{
                      $("[id$=abcj]").prop("disabled",false);
                      $("[id$=defj]").prop("disabled",true);
                      $("[id$=ghij]").prop("disabled",true);
                     
                }              
            });
        });   
        
            $(document).ready(function(){
             $("[id$=defj]").change(function(){
                if(this.checked){
                        $("[id$=ghij]").prop("checked",false);                                       
                }
            
            });
        }); 
        
             $(document).ready(function(){
             $("[id$=ghij]").change(function(){
                if(this.checked){
                        $("[id$=defj]").prop("checked",false);                                       
                }
            
            });
        });    
</script>