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
Nurav1982Nurav1982 

How to render PageBlockSections as "not collapsed" by default ?

We currently have a set of 6 <apex:pageBlockSection> in our VF page.
All 6 of these pageblocksection render collapsed by default.
We want to find out whether it would be feasible to render these pageblocksections as "not collapsed" by default.
Nurav1982Nurav1982
EDIT : The requirement is to render pageblocksections as "collapsed" by default.Sorry for the confusion
souvik9086souvik9086
Do like this

<script>
function addLoadEvent(func) {
      var oldonload = window.onload;
      if (typeof window.onload != 'function') {
        window.onload = func;
      } else {
        window.onload = function() {
          if (oldonload) {
            oldonload();
          }
          func();
        }
      }
    }
function dotest() {
     if(document.getElementById('myPage:PageForm:pageBlock:PageBlockSection1') != null){
         twistSection(document.getElementById('myPage:PageForm:pageBlock:PageBlockSection1').childNodes[0].childNodes[0]);
     }
    
     if(document.getElementById('myPage:PageForm:pageBlock:PageBlockSection2') != null){
         twistSection(document.getElementById('myPage:PageForm:pageBlock:PageBlockSection2').childNodes[0].childNodes[0]);
     }
     if(document.getElementById('myPage:PageForm:pageBlock:PageBlockSection3') != null){
         twistSection(document.getElementById('myPage:PageForm:pageBlock:PageBlockSection3').childNodes[0].childNodes[0]);
     }
     if(document.getElementById('myPage:PageForm:pageBlock:PageBlockSection4') != null){
         twistSection(document.getElementById('myPage:PageForm:pageBlock:PageBlockSection4').childNodes[0].childNodes[0]);
     }
     if(document.getElementById('myPage:PageForm:pageBlock:PageBlockSection5') != null){
         twistSection(document.getElementById('myPage:PageForm:pageBlock:PageBlockSection5').childNodes[0].childNodes[0]);
     }
     if(document.getElementById('myPage:PageForm:pageBlock:PageBlockSection6') != null){
         twistSection(document.getElementById('myPage:PageForm:pageBlock:PageBlockSection6').childNodes[0].childNodes[0]);
     }

addLoadEvent(dotest);
</script>
<apex:PageBlockSection title="{!$Label.pf_PageEntryOption}" columns="2" id="PageBlockSection1">
<apex:PageBlockSection title="{!$Label.pf_PageEntryOption}" columns="2" id="PageBlockSection2">
<apex:PageBlockSection title="{!$Label.pf_PageEntryOption}" columns="2" id="PageBlockSection3">
<apex:PageBlockSection title="{!$Label.pf_PageEntryOption}" columns="2" id="PageBlockSection4">
<apex:PageBlockSection title="{!$Label.pf_PageEntryOption}" columns="2" id="PageBlockSection5">
<apex:PageBlockSection title="{!$Label.pf_PageEntryOption}" columns="2" id="PageBlockSection6">