Interview questions on visualforce pages – 2

Interview questions on visualforce pages – 2




11. What is <apex:form> tag?

<Apex:form> tag allow a section of a visualforce page to enter input values & Buttons to submit it. The body of the form tag contains, how data is placed & how it is process. The best practice is to use only one form tag in page.

12. What is <apex:pageBlock> tag?

<Apex:pageBlock> helps you to provide standard salesforce detail page look and feel in your visual force pages without any default content.

13.What is <apex:pageBlockSection> tag?

<apex:pageBlockSection> tag represents a section of data with in an <apex:pageBlock> component, which is similar to a section in a standard salesforce page layout. In page block section we can define number of columns required to display in a single page. This component must be a child <apex:pageBlock>

14. What is <apex:pageBlockButtons>?

<apex:pageBlockButtons> tag is used to display buttons & links in salesforce standard format. This tag must be a child of <apex:pageBlock>

15. Can we define <apex:pageBlockButtons> under <apex:pageBlockSection> tag?

No, <apex:pageBlockButtons> must be direct child of <apex:pageBlock> tag.



Visualforce page to explain about tags mentioned in above questions.

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

 This code displays a small form to enter account name & type. See the below screen to see the output of above code.

Interview questions on visualforce pages - 2





Leave a Reply