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
Victor19Victor19 

Display sections based on checkboxes checked

Hi Everyone,

 

I would like to get some suggestions on how to display sections on a Visualforce page based on specific checkboxes selected.

 

For eg: I have 4 checkboxes: 1, 2, 3, and 4 & I have 4 Sections on the VF page: Section A, B, C, D.

 

When Checkbox 1 is checked: Section A and B has to appear

            Checkbox 2 is checked: Section A, C and D has to appear

            Checkbox 3 is checked: Section A and C has to appear

            Checkbox 4 is checked: Section A and D has to appear

 

If someone could share some sample code or any suggestions would be greatly appreciated.

 

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
Sandeep001Sandeep001

It could be done using rendered attribute in apex:pageblocsection or any other component like outputPanel etc. You can actually write

<apex:pageBlockSection rendered="{!isRender}">

 isRender variable should be maintained as boolean type.

All Answers

Sandeep001Sandeep001

It could be done using rendered attribute in apex:pageblocsection or any other component like outputPanel etc. You can actually write

<apex:pageBlockSection rendered="{!isRender}">

 isRender variable should be maintained as boolean type.

This was selected as the best answer
Victor19Victor19
Hi Sandeep,

I would really appreciate if you could provide some sample code (controller and VF) if you have any.

Thanks!