Recipes by Category
App Distribution (2)
Bundle logic, interface and services for distribution.
App Logic (37)
The Apex programming language, workflow and formulas for logic.
Collaboration (6)
The Salesforce Chatter collaboration platform.
Database (29)
Data persistence, reporting and analytics.
Integration (33)
Web Service APIs and toolkits for integration.
Security (9)
Platform, application and data security.
Tools (4)
Force.com tooling
User Interface (36)
Visualforce MVC and metadata-drive user interfaces.
Web Sites (12)
Public web sites and apps with optional user registration and login.
Cookbook Home » Show a PageBlockSection Collapsed by Default
Share
X
Vote to Verify a Recipe
Verifying a recipe is a way to give feedback to others and broaden your own understanding of the capabilities on Force.com. When you verify a recipe, please make sure the code runs, and the functionality solves the articulated problem as expected.
Please make sure:- All the necessary pieces are mentioned
- You have tested the recipe in practice
- Have sent any suggestions for improvements to the author
Please Log in to verify a recipe

Recipe Activity - Please Log in to write a comment
You can actually use the twistAllSections(); to collapse all sections (From javascript). That way 1) you don't need to use jquery 2) you don't have to iterate through DOM elements.
<apex:pageBlockSection title="Insurance coveres" id="section1">
Section content......
</apex:pageBlockSection>
Another Solution:
</script>
Great! post,
I suggest that you move the detail link out of the pageblock and use
<apex:outputtext value="{!detailLink}" id="theLink" escape="false"/>
Good luck.
Chris O Davies
I love the idea of this code, but the link code in the pageBlock doesn't work. getDetailLink() doesn't return HTML like you think, it's encoded.
If I move the link inside the pageBlock code, then it works as expected, but the UI effect isn't the same.
If anyone has any ideas how to make the title a clickable link, that would be greatly appreciated!
Thanks!