1

I have a very simple Visualforce Page with using custom object called employee__c

I'm trying to save the data whatever the user have entered in the page, but I'm not getting any error from my below code but the page is blank not showing any input fields at all....

here is my VF page code:

<apex:page Controller="EmployeeController" >
  <!-- Page Header -->
  <apex:sectionHeader title="Employee Edit" subtitle="New Employee" />

  <!-- Begin Form -->
  <apex:form >
    <apex:pageBlock title="Employee Informations" mode="edit"> 

      <apex:pageBlockSection columns="2" showHeader="true" title="Information"> 
        <apex:inputField id="firstName" value="{!emp.First_Name__c}" required="true" />
        <apex:inputField id="lastName" value="{!emp.Last_Name__c}"  required="true" />     
      </apex:pageBlockSection>
  </apex:pageBlock>
  </apex:form>
</apex:page>

my controller:

public with sharing class EmployeeController {

    public ApexPages.StandardController controller; 


    Public Employee__c emp = new Employee__c();
    public Employee__c getemp()
    {
        return emp;
    }

    Public String First_Name {get; set;}
    Public String Last_Name {get; set;}  


    public EmployeeController(ApexPages.StandardController Controller)
    {
        emp = (Employee__c)Controller.getRecord(); 
        this.controller=Controller;  
    } 
    public PageReference save() {
      insert emp; 
      return null;
    }    
}
  • 1
    Did you check the FLS and make sure the user has access to the fields? – Eric Oct 29 '15 at 18:44
  • Do you mean that the page heading and page block are shown but no field label or input areas are shown at all when the page is initially opened? – Keith C Oct 29 '15 at 22:39
0

Ensure the field level security is set to editable for your profile. Also you should have create permission on Employee object to create records

  • can you expand your answer little bit more so other might benefit from it, like how do you go after FLS and how do you create permission on the object – Nick Kahn Oct 29 '15 at 18:49
  • go to your object details page. click on First_Name__c-> select edit field level security. select all the profiles. – Himanshu Oct 29 '15 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.