<apex: pageBlock> Component in Visualforce Page

The <apex: pageBlock> component is the most used component on the Visualforce page that specifies the page area having a similar appearance to the Salesforce detail page. This component supports the HTML pass-through attributes by using the "html-" prefix. The attributes are attached to the generated container <div> tag.

The <apex: pageBlock> component has the following attributes on the Visualforce page:

1. dir

The dir is a string-type attribute used to specify the direction in which the generated HTML component should be read. LTR and RTL are the two possible values for this attribute.

Syntax:

2. helpTitle

The helpTitle is a string-type attribute used for specifying the text that needs to be displayed when the user hovers the mouse over the help link for the page block. If we specify this attribute, we should have to provide a value for helpTitle The helpTitle attribute is ignored if we specify the header facet value in the pageBlock.

Syntax:

3. helpUrl

The helpUrl is a string-type attribute used for specifying the webpage URL that provides help for the pageBlock. If we specified this attribute, we should have to provide a value for helpURL. The helpTitle attribute is ignored if we specify the header facet value in the pageBlock.

Syntax:

4. id

The id is a string-type attribute, i.e., a unique identifier that allows this component to be referenced by other components on the page.

Syntax:

5. lang

The lang is a string-type attribute that specifies the base language used for the generated HTML output. The values can be "en" or "en-US" etc.

Syntax:

6. mode

The mode is a string-type attribute used to specify the mode for the page block area. These are the possible value for this attribute:

  1. detail
  2. maindetail
  3. edit
  4. inlineEdit

Syntax:

7. onclick

The onclick is another string-type attribute used to specify the JavaScript method that needs to be invoked when the onclick event occurs or when the user clicks the page block.

Syntax:

8. ondblclick

The ondblclick is a string-type attribute used to specify the JavaScript method that needs to be invoked when the ondblclick event occurs or when the page block is clicked twice.

Syntax:

9. onkeydown

The onkeydown is a string-type attribute used for specifying the JavaScript method that needs to be invoked when the onkeydown event occurs or when the user presses a keyboard key.

Syntax:

10. onkeypress

The onkeypress is a string-type attribute used for specifying the JavaScript method that needs to be invoked when the onkeypress event occurs or when the user holds down or presses a keyboard key.

Syntax:

11. onkeyup

The onkeyup is a string-type attribute used for specifying the JavaScript method that needs to be invoked when the onkeyup event occurs or when the user releases a keyboard key.

Syntax:

12. onmousedown

The onmousedown attribute is a string-type attribute used to invoke the JavaScript method when the onmousedown event occurs or when the user presses the mouse button.

Syntax:

13. onmousemove

The onmousemove is a string-type attribute used for specifying the JavaScript method that needs to be invoked when the onmousemove event occurs or when the user moves the mouse pointer.

Syntax:

14. onmouseout

The onmouseout is a string-type attribute used for specifying the JavaScript method that needs to be invoked when the onmouseout event occurs or when the user moves the mouse pointer away from the page block.

Syntax:

15. onmouseover

The onmouseover attribute is a string-type attribute used to invoke the JavaScript method when the onmouseover event occurs or when the user moves the pointer over the page block.

Syntax:

16. onmouseup

The onmouseup is a string-type attribute used for specifying the JavaScript method that needs to be invoked when the onmouseup event occurs or when the user releases the mouse button.

Syntax:

17. rendered

The rendered is a Boolean-type attribute used to specify whether this component is rendered on the page. Boolean-value true is set as a default value for this attribute.

Syntax:

18. tabStyle

The tabStyle is a string-type attribute used to specify the Salesforce object or custom Visualforce tab that controls the color scheme of the page block.

Syntax:

19. title

The title is a string-type attribute used to specify the text that needs to be displayed as the title of the page block.

Syntax:

Let's take an example to understand how we can use the <apex: pageBlock> component inside the VF page:

ApexPageBlockExample.vfp

Output

apex: pageBlock Component in Visualforce Page




Latest Courses