I have VF page to override standard contact "new" button page, In that VF page i have Project field which will get the picklist value(project name) dynamically when i insert one project(custom object) record, I'm facing problem when i'm saving record, that is even if i select one project name from pick list it is not saving, can't able to save the record.

Here is my VF page and controller.

VF Page

<apex:page standardController="Contact" extensions="Account_ext" tabStyle="account" sidebar="false" >
<apex:form >
 <apex:pageBlock title="Person Contact Edit">
   <apex:pageBlockButtons >
       <apex:commandButton value="Save" action="{!save}"/>
       <apex:commandButton value="Cancel" action="{!cancel}"/>
       <apex:commandButton value="Save & New" />

    <Apex:pageBlockSection >

     <apex:pageBlockSectionItem >
<apex:outputlabel value="First Name"/>
<apex:outputpanel >
    <apex:outputfield value="{!Contact.Salutation}" />
    <apex:outputfield value="{!Contact.FirstName}" />


        <Apex:inputField value="{!Contact.Lead_Source__c}" />
        <apex:inputField value="{!Contact.Enquiry_Budget__c}"/>
         <apex:inputField value="{!Contact.Enquiry_check__c}"/>
        <apex:inputField value="{!Contact.Enquiry_Flat_Type__c}"/>
         <apex:inputField value="{!Contact.Enquiry_Locality_Preference__c}"/>
         <apex:inputField value="{!Contact.Enquiry_Location__c}"/>
          <apex:inputField value="{!Contact.Enquiry_Name__c}"/>
         <apex:inputField value="{!Contact.Enquiry_Potential_Name__c}"/>
         <apex:inputField value="{!Contact.Enquiry_Property_Type_Preference__c}"/>
         <apex:inputField value="{!Contact.Enquiry_Type_Of_Purchase__c}"/>
         <apex:inputField value="{!Contact.Lead_Source__c}"/>
       <apex:inputField value="{!Contact.Mailing_City__c}"/>
     <apex:inputField value="{!Contact.Mailing_Country__c}"/>
       <apex:inputField value="{!Contact.Mailing_State_Province__c}"/>
       <apex:inputField value="{!Contact.Mailing_Street__c}"/>
       <apex:inputField value="{!Contact.Mailing_Zip_Postal_Code__c}"/>  
       <apex:inputField value="{!Contact.Opportunities__c}"/>
       <apex:inputField value="{!Contact.Project__c}"/>

      <apex:pageBlockSectionItem >
       <apex:outputLabel >Project</apex:outputLabel>
                    <apex:selectList multiselect="false" size="1" value="{!prj_Name}">
                        <apex:selectOptions value="{!prj}" />




public class Account_ext {

    public Account_ext(ApexPages.StandardController controller) {


    public string prj;
    public string prj_name{get;set;}

    List<selectOption> options = new List<selectOption>();
    public List<selectOption> getprj() {
        for(project__c acc : [select Id,name from project__c])
            options.add(new selectOption(acc.name,acc.name));
        return options;


Thanks in Advance :)


It looks like prj_name is just a controller property and these are not automatically persisted.

You need to bind your apex:selectList to an SObject field, in this case presumably a custom field added to Contact (e.g. Contact.Prj_Name__c), so that when the standard controller save is invoked the value is automatically saved as part of the Contact SObject.

| improve this answer | |

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.