+ Start a Discussion

twistSection is not defined (javascript error for pageBlockSection)

Why do I get "twistSection is not defined" javascript errors for the following use of pageBlockSection?



<apex:page standardController="Account" extensions="OEMTeamReportController" showHeader="true" tabStyle="account" standardStylesheets="true" title="OEM Services Team Resources"> <apex:form > <apex:pageBlock title="OEM Opportunities for Review"> <apex:repeat value="{!accounts}" var="this_account"> <apex:pageBlockSection title="{!this_account.acct.Name}" columns="1" collapsible="true">

<table class="opps_table">





I'm getting the same problem also.  It appears to be working on one page and not another.  I'm unable to locate the problem. 


Shikibu - have you found the solution to this issue yet?



No, I did not find a resolution.
Benjamin Pirih.ax1481Benjamin Pirih.ax1481



If you add the following script section to the page it will work properly.  Not sure why the sf.com script is not loading correctly..





function twistSection(twisty, sectionId) {

//twistSection code from salesforce.com

var parentDiv = twisty;

while (parentDiv.tagName != 'DIV') { parentDiv = parentDiv.parentNode; }

var headerId = sectionId || (parentDiv.id.split('_'))[1];

var div = parentDiv.nextSibling;

var elemWasOn = false;

if (div.style.display != 'none')


div.style.display = 'none';

twisty.className ='showListButton';

twisty.alt = twisty.title = 'Show Section - '+twisty.name;

elemWasOn = true;




div.style.display = 'block';

twisty.className ='showListButton';

twisty.alt = twisty.title = 'Show Section - '+twisty.name;

elemWasOn = false;







Daniel BallingerDaniel Ballinger

I found another possible workaround. Inject a fake pageBlockSection immediately after the wrapping pageBlock. This forced Salesforce to inject the missing twistSection function.


See apex:pageBlockSectionItem collaspe or expand throws “twistSection is not defined” JavaScript exception