Salesforce Menu

Visualforce interview Question

1. What is visualforce?
 Visualforce is tag based markup language to develop customized user interface in salesforce.

2. What is visualforce controller in salesforce? What are they?
Visualforce controller is a set of instructions that specify what happens, when user interacts with components on visualforce pages, such buttons & links.
There are three types of controllers. They are.
Standard Controller, Custom controller & Controller extensions.

3. What is Standard Controller?
Standard controller provides the salesforce in built functionality to interact with visualforce pages. You can use the standard actions like Save, Edit, Cancel & delete by using standard controllers.
Syntax : <apex:page standardController=”Account”>

4. What is Standard List Controller?
Standard List Controller allows to display list of records in visualvalfoce page. Standard list controller provides additional pagination actions (First, Lat, Next & Previous) compared to standard controller.
Syntax : <apex:page standardController=”Account” recordSetVar=”accounts”>
defining this controller is similar to standard controller. But need to add one more attribute recordSetVar

5. What is Custom Controller?
Custom controller is an apex class that implements customized logic to visualfore pages.
We can override or create new functionality by using custom controllers.
Syntax : <apex:page controller=”Account” >

6. What are the tasks of standard controller?
Standard controllers provides ability to access and interact with structured business data contained in records displays in the proper user interface.
Standard controller tasks : controlling data, controlling actions and controlling navigation.

7. How can you create visualforce page in salesforce?
We can create visualforce pages in two ways.

  1. From the setup menu go to Setup > develop > Visualforce Pages
   click on new button to create a page & enter name & code for visualforce page.
  2. From the vsualforce editor. Enter /apex/pagename at the url & create new page in visualforce editor.

8. What is <apex:page> tag in visualforce markup?
This tag represents a single visualforce page. Every page must start & end with this tag.

<apex:page>
 <!– Body of the page –>
</apex:page>

9. How can we enable visualforce editor?
We need to check the “development mode” check box at user level to enable visualforce editor.
To enable this, go to user details page check the development mode check box.

10. 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.

11. 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.

12. 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>

13. 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>

14. 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>

Subscribe Now