<apex: outputField> Component in Visualforce PageThe <apex: outputField> is one of the most used components in Visualforce Page that act as a read-only display of a label and value for a Salesforce object's field. All the attributes associated with the Salesforce field are respected by this component. We use this component for getting input from the user for a controller method that doesn't correspond to a Salesforce Object's field. The <apex: outputField> component should always be the child of the <apex: pageBlock> and <apex: pageBlockSectionItem> components. HTML pass-through attributes are supported by this component by using the "html-" prefix. The <apex: outputField> component has the following attributes on Visualforce Page: 1. dir The dir is a string-type attribute that is used for specifying the direction in which the generated HTML component should be read. RTL and LTR are the two possible values for this attribute. Syntax: 2. 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: 3. label The label is a string-type attribute that is used for specifying the text value that needs to be used as the component label. Syntax: 4. lang The lang is a string-type attribute that is used for specifying the base language for the generated HTML output. Syntax: 5. rendered The rendered is a Boolean-type attribute that is used for specifying whether this component needs to be rendered on the page or not. Boolean-value true is set as a default value for this attribute. Syntax: 6. style The style is a string type attribute used to specify the inline CSS style that will be applied for displaying the input component. Syntax: 7. styleClass The styleClass is a string type attribute used to specify the style class that will be applied for displaying the input component. Syntax: 8. title The title is a string-type attribute used to specify the text that needs to be displayed as a tooltip when the user hovers the mouse pointer over this component. Syntax: 9. value The value is an Object-type attribute that is used for specifying the expression that references the Salesforce field associated with this output field. Syntax: Let's take an example to understand how we can use this component on Visualforce Page: ApexOutputFieldExample.vfp Output |