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

On clicking checkbox related panel has to be displayed

Onclicking the checkbox related question has to display, i have out only two questions in data as of now.

On clicking the checkbox it is returing the correct Id and I am setting the id to show() but the panel is not displaying.

Can someone please look at the code

public class ProposalManagementController{
    private list <Quoting_Tool_Questions__c> qlist;
    public list <ProposalManagementWrapper> wrapperlist;
    public ProposalManagementController(){}
    public list <ProposalManagementWrapper> getQuestions(){
            wrapperlist =  new list <ProposalManagementWrapper> ();
            qlist = [select id,name,Question__c,Question_Order__c,Section_Name__c,Section_Order__c,Key__c,Dependent_Question__c  from Quoting_Tool_Questions__c ORDER BY Question_Order__c ASC];
            system.debug('Question -->' + qlist );
            for(Quoting_Tool_Questions__c q:qlist){
                wrapperlist.add(new ProposalManagementWrapper(q));
                system.debug('WrapperList --->' + wrapperlist);
        }catch(exception e){e.getMessage();}   
        return wrapperlist;
    public void displayPanel(){
    public class ProposalManagementWrapper{
        public list <Quoting_Tool_Answeres__c> alist {get;set;}
        public Quoting_Tool_Questions__c q {get;set;}
        public boolean displayFlag{get;set;}
        public string Key{get;set;}
        public  ProposalManagementWrapper (Quoting_Tool_Questions__c  q){
            this.q = q;
            if(q.Dependent_Question__c == true){
                this.displayFlag = true;
                this.displayFlag = false;
            if(q.Key__c != null){
                Key = '-' + q.Key__c ;
                Key = '';
            this.alist = [select id,name,Answere__c,Key__c,Order__c,Quoting_Tool_Questions__c from Quoting_Tool_Answeres__c where Quoting_Tool_Questions__c =:q.Id  ORDER BY Order__c ASC];

<apex:page sidebar="false"  showHeader="false" controller="ProposalManagementController">
    <style type="text/css">

    <script type="text/javascript">
             $('*[id*=block-]:visible').each(function() {
         function panelRender(val){
             var id = "block-" + val;
    <apex:includeScript value="{!$Resource.Jquery}"/>
            <table id="thetable" style="width:100%;">
            <apex:repeat value="{!Questions}" var="wrapper">
                 <tr id="block{!wrapper.Key}">
                     <td class="textfield" >
                         <table style="width:60%;">
                                 <td style="width:20%;" align="right">
                                     <apex:outputLabel for="timeframe"><b>{!wrapper.q.Question__c}</b></apex:outputLabel>
                                 <td style="width:20%;" >
                                     <apex:repeat value="{!wrapper.alist}" var="a">
                                             <apex:outputText value="{!a.Answere__c}" >
                                                 <apex:inputCheckbox title="{!a.Name}" value="{!a.Key__c}" onclick="panelRender('{!a.Key__c}')"/>
Try using action support tag and rerender.

<apex:inputField title="{!a.Name}" value="{!a.Key__c}">
    <apex:actionSupport event="onchange" action="panelRender('{!a.Key__c}')"
                        rerender="<id of the section>"/>
Thanks for the reply

But I am getting this error 'Formula Expression is required on the action attributes.'
So action attribute cannot call a js script
In that case actionfunction might work. Just a thought as per the article at the link

Came across the below post that might provide some inputs on the same