anusha(salesforce developer)

Friday, 29 July 2016

How To Use <apex:pageBlockButtons> In Visualforce Page?

<apex:pageBlockButtons>:
Whenever <apex:commandbutton> tag is used, a button is created in a based on the position where the tag is written.  But most of the times, we may want to place the buttons on the top or bottom of the page. This can be achieved with the help of this tag. 


This component must be a child component of an < apex:pageBlock >.

This tag supports following attributes: 

Attribute
Description
dir
The direction in which the generated HTML component should be read. Possible values include "RTL" (right to left) or "LTR" (left to right).
id
An identifier that allows the pageBlockButtons component to be referenced by other components in the page.
lang
The base language for the generated HTML output, for example, "en" or "en-US".
location
The area of the page block where the buttons should be rendered. Possible values include "top", "bottom", or "both". If not specified, this value defaults to "both". Note that if a pageBlock header facet is defined, the facet overrides the buttons that would normally appear at the top of the page block. Likewise if a pageBlock footer facet is defined, the facet overrides the buttons that would normally appear at the bottom of the page block.
onclick
The JavaScript invoked if the onclick event occurs--that is, if the user clicks anywhere in the pageBlockButtons component
ondblclick
The JavaScript invoked if the ondblclick event occurs that is, if the user clicks the pageBlockButtons component twice.
onkeydown
The JavaScript invoked if the onkeydown event occurs that is, if the user presses a keyboard key.
onkeypress
The JavaScript invoked if the onkeypress event occurs that is, if the user presses or holds down a keyboard key.
onkeyup
The JavaScript invoked if the onkeyup event occurs that is, if the user releases a keyboard key.
onmousedown
The JavaScript invoked if the onmousedown event occurs that is, if the user clicks a mouse button.
onmousemove
The JavaScript invoked if the onmousemove event occurs that is, if the user moves the mouse pointer.
onmouseout
The JavaScript invoked if the onmouseout event occurs that is, if the user moves the mouse pointer away from the pageBlockButtons component.
onmouseover
The JavaScript invoked if the onmouseover event occurs that is, if the user moves the mouse pointer over the pageBlockButtons component.
onmouseup
The JavaScript invoked if the onmouseup event occurs that is, if the user releases the mouse button.
rendered
A Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true.
style
The style used to display the pageBlockButtons component, used primarily for adding inline CSS styles.
styleClass
The style class used to display the pageBlockButtons component, used primarily to designate which CSS styles are applied when using an external CSS stylesheet.
title
The text to display as a tooltip when the user's mouse pointer hovers over this component.

Visualforce Example:


<apex:page standardController="Account">
    <apex:form >
        <apex:pageBlock title="My Content" mode="edit">
            <apex:pageBlockSection title="My Content Section" columns="2">
                <apex:inputField value="{!account.name}"/>
                <apex:inputField value="{!account.site}"/>
                <apex:inputField value="{!account.type}"/>
                <apex:inputField value="{!account.accountNumber}"/>
            </apex:pageBlockSection>
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>






No comments:

Post a Comment