function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SKumar SFDCSKumar SFDC 

Standard VF Page - Enhancement

Hello,

I'm newbee for SFDC and please clarify my below doubt.

While creating custome VF page, we create custom Controllers as class, Fields as variables and the logic which ever written in that class controlls Controller behaviour of the page.. This is what I know for custom page creation using VF

But my question is.....

1. Assume I created a custom object and created 2 fields using customization, How can I create a custom controller for this page? How can I write a behaviour of those 2 fields?

2. I don't see Developer mode coumn (at the bottom of the page) for a page which is achieved through customization but I can only see for custome VF Page.

Please clarify and thanks in advance.
 
Pankaj_GanwaniPankaj_Ganwani
Hi,

1. You can create custom page and its controller using below mentioned code:
<apex:page controller="classname">
<apex:form>
  <apex:inputField value="{!objObjectName.fieldName}"/>
</apex:form>
</apex:page>

Controller:
public class className
{
      public objName obj{get;set;}
      public className{
     obj = new objName();
}
}

2. You will have to go to user detail page and check the developer mode checkbox.
SKumar SFDCSKumar SFDC
Hello Pankaj,

Thanks for your response.

I think you didn't got me correctly. I know how to create a custom page, controller & class for that controller.. That is not where I stuck.

Assume, through customization I created one App 'MyApp', Object 'Timesheet', in the object time sheet I created 2 fields Employee Name & Designation. Now how can I write a controller for this Timesheet Object page? I can only see developer mode for custom VF page which I created ex: https://c.ap1.visual.force.com/apex/myApp but not to a customized page.

Hope now you got me.. Thanks. 
Madhanprabhu Thangadurai 1Madhanprabhu Thangadurai 1

Hi Kumar,

You have a custom object called "Timesheet" and its API Name is "Timesheet__c". If you want to create a customized visualforce with some business logic, say for example to list all the Timesheet object records as list with Pagination. In that case, you need to create a Custom Controller (Apex Class) to do the business logic. Here you need to declare controller = "Timesheet__c" and extentions = "Your Apex Class Name" 
 
<apex:page controller="Timesheet__c" extensions="TimesheetController">
     <apex:form>
          <apex:inputField value="{!Timesheet__c.Name}"/>
     </apex:form>
</apex:page>
public class TimesheetController { 
   public String Name{get;set;} 
   public TimesheetController
   { 
   } 
  // Other Business Logic to do Pagination
}

Else if you want to display a customized record detail page of Timesheet object you can directly use controller = "Timesheet__c"
<apex:page controller="Timesheet__c">
     <apex:form>
          <apex:inputField value="{!Timesheet__c.Name}"/>
     </apex:form>
</apex:page>
Enabling Developer Mode:

Go to Setup -> Manage Users -> Users. Then select the User which you want to enable the Developer Mode. Click Edit and Check "Development Mode" check box.

User-added image