apex:pageBlock

An area of a page that uses styling similar to the appearance of a Salesforce detail page, but without any default content.

This component supports HTML pass-through attributes using the “html-” prefix. Pass-through attributes are attached to the generated container <div> tag.

Example 

1<!-- For this example to render properly, you must associate the Visualforce page
2with a valid account record in the URL.
3For example, if 001D000000IRt53 is the account ID, the resulting URL should be:
4https://MyDomain_login_URL/apex/myPage?id=001D000000IRt53
5See the Visualforce Developer's Guide Quick Start Tutorial for more information. -->
6
7
8<!-- Page: -->
9<apex:page standardController="Account">
10    <apex:form>
11        <apex:pageBlock title="My Content" mode="edit">
12            <apex:pageBlockButtons>
13                <apex:commandButton action="{!save}" value="Save"/>
14            </apex:pageBlockButtons>
15            <apex:pageBlockSection title="My Content Section" columns="2">
16                <apex:inputField value="{!account.name}"/>
17                <apex:inputField value="{!account.site}"/>
18                <apex:inputField value="{!account.type}"/>
19                <apex:inputField value="{!account.accountNumber}"/>
20            </apex:pageBlockSection>
21        </apex:pageBlock>
22    </apex:form>
23</apex:page>

Attributes 

Attribute NameAttribute TypeDescriptionRequired?API VersionAccess
dirStringThe direction in which the generated HTML component should be read. Possible values include “RTL” (right to left) or “LTR” (left to right). 10.0global
helpTitleStringThe text that displays when a user hovers the mouse over the help link for the page block. If specified, you must also provide a value for helpURL. Note that if a value for a header facet is included in the pageBlock, this attribute is ignored. 12.0global
helpUrlStringThe URL of a webpage that provides help for the page block. When this value is specified, a help link appears in the upper right corner of the page block. If specified, you must also provide a value for helpTitle. Note that if a value for a header facet is included in the pageBlock, this attribute is ignored. 12.0global
idStringAn identifier that allows the pageBlock component to be referenced by other components in the page. 10.0global
langStringThe base language for the generated HTML output, for example, “en” or “en-US”. For more information on this attribute, see the W3C specifications. 10.0global
modeStringThe default user mode for the pageBlock component’s child elements. This value determines whether lines are drawn separating field values. Possible values are: detail – data is displayed to the user with colored lines. maindetail – data is displayed to the user with colored lines and a white background, just like the main detail page for records. edit – data is displayed to the user without field lines. inlineEdit – data is displayed as in detail mode, but child components that support it are enabled for inline editing. Displayed lines have nothing to do with requiredness, they are merely visual separators, which make it easier to scan a detail page. If not specified, this attribute defaults to detail. 10.0global
onclickStringThe JavaScript invoked if the onclick event occurs–that is, if the user clicks the page block. 10.0global
ondblclickStringThe JavaScript invoked if the ondblclick event occurs–that is, if the user clicks the page block twice. 10.0global
onkeydownStringThe JavaScript invoked if the onkeydown event occurs–that is, if the user presses a keyboard key. 10.0global
onkeypressStringThe JavaScript invoked if the onkeypress event occurs–that is, if the user presses or holds down a keyboard key. 10.0global
onkeyupStringThe JavaScript invoked if the onkeyup event occurs–that is, if the user releases a keyboard key. 10.0global
onmousedownStringThe JavaScript invoked if the onmousedown event occurs–that is, if the user clicks a mouse button. 10.0global
onmousemoveStringThe JavaScript invoked if the onmousemove event occurs–that is, if the user moves the mouse pointer. 10.0global
onmouseoutStringThe JavaScript invoked if the onmouseout event occurs–that is, if the user moves the mouse pointer away from the page block. 10.0global
onmouseoverStringThe JavaScript invoked if the onmouseover event occurs–that is, if the user moves the mouse pointer over the page block. 10.0global
onmouseupStringThe JavaScript invoked if the onmouseup event occurs–that is, if the user releases the mouse button. 10.0global
renderedBooleanA Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true. 10.0global
tabStyleStringThe Salesforce object or custom Visualforce tab that controls the color scheme of the page block. If not specified, this value defaults to the style of the page. If using a Salesforce object, the attribute must be specified with the developer name for the object. For example, to use the styling associated with MyCustomObject, use tabStyle=“MyCustomObject__c”. To use a custom Visualforce tab, set the attribute to the name (not label) of the tab followed by a double-underscore and the word tab. For example, to use the styling of a Visualforce tab with the name Source, use tabStyle=“Source__tab”. 10.0global
titleStringThe text displayed as the title of the page block. Note that if a header facet is included in the body of the pageBlock component, its value overrides this attribute. 10.0global

Facets 

Facet NameDescriptionAPI Version
footerThe components that appear at the bottom of the page block. If specified, the content of this facet overrides any pageBlockButton components in the pageBlock. Note that the order in which a footer facet appears in the body of a pageBlock component does not matter, because any facet with name=“footer” will control the appearance of the bottom block.10.0
headerThe components that appear in the title bar of the page block. If specified, the content of this facet overrides the pageBlock title tab, any pageBlockButton components, and the value of the helpTitle and helpURL attributes in the pageBlock. Note that the order in which a header facet appears in the body of a pageBlock component does not matter, because any facet with name=“header” will control the appearance of the title.10.0