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
DeclanDeclan 

VisualForce - Customcontroller not displaying values

Hi,

I am trying to create a simple userface that will allow me to update fields on a custom object which will then update the database.

I am new to VF so any help would be appreciated.

This is what i have so far.
Apex class:
public with sharing class Declan3 {

    public Declan3(ApexPages.StandardController controller) {

    }


   


   public class reference {
        public Reference__c ref {get; set;}
        public List<Test_Service_Item__c> items { get; set; }
        
        public reference(Reference__c ref, List<Test_Service_Item__c> items) {
            this.ref = ref;
            this.items = items;
        }
    }

}

And VF Page:
<apex:page standardController="Test_Service_Item__c" extensions="Declan3" >
<apex:pageMessages ></apex:pageMessages>
    <apex:pageBlock id="thePageBlock" >
        <apex:pageBlockSection title="test" columns="1">
        <apex:form >
      
        <apex:outputfield value="{!Test_Service_Item__c.id}"/>
        
        <apex:inputfield value="{!Test_Service_Item__c.Quantity__c}"  />
        <apex:inputfield value="{!Test_Service_Item__c.Reference_Standard_Link__c}" />    
        <apex:commandButton action="{!save}" value="save"/>     
        
         </apex:form>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>

The fields are blank and if i try input information and click save i am getting the following error. "Error:
Reference: Required fields are missing: [Reference]"


 
sandeep@Salesforcesandeep@Salesforce
Hi Declan, 

When you use standard controller then in order to display field values on page Please make sure that url you are hitting to load VF page should have id parameter with valid id of record of object. In your case your URL should end with 

/apex/yourpagename?id=XXXXXXXXXXXXXX here id parameter should have value of record id of object Test_Service_Item__c. 
Please mark this answer as best asnwer if it works for you so that it may help others as well. Please let me know in case of any further queries.

Thanks
Sandeep Singhal
http://www.codespokes.com/
DeclanDeclan
Hi Sandeep
I tried this but still having the same problem.

Any other ideas?