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

How do i bind the extension with the visualforce action

I have a scenario wherein i have to create a lookup field on the visualforce page--> select a contact--> fetch 5 fields of that contact --> make changes in the field value --> save it back--> Changes should reflect back in the backend.

Please let me know how to go about this.
I am new in this technology, so i very little idea of it.

Axaykumar VaruAxaykumar Varu
Create visualforce page with standard controller as contact put whichever fields you want to modify in apex:inputField tag. put save and cancel button as well.

for example:
<apex:page standardController="Contact" >


<apex:commandButton value="Save" title="Save" action="{!save}" />

<apex:inputField value="{!contact.FirstName}" />



Hey Axay,
The thing that I need to do here is, first have a lookup field to Contact Object on the VF page--> then fetch 5 fields of the selected contact--> get the 5 field values in text boxes--> edit those values--> save it back.

I could not follow your previous code.
Please let me know,what is the way to achieve it.

VF Page
<apex:page standardController="Contact" extensions="ModifyContactData">
<apex:form >
<apex:inputField id="contactList" value="{!cont.SuperContact__c}"/>
<apex:pageBlock >
<apex:pageBlockTable id="pageblock1" value="{!contDetail}" var="contactdetail">
<apex:inputField id="contName" value="{!}"/>
<apex:inputField id="contPhone" value="{!}"/>
<apex:inputField id="contEmail" value="{!contactdetail.Email}"/>

 <apex:commandButton value="GO!" action="{!go}"/>   



public class ModifyContactData
    public Contact cont{get;set;}
    public Contact contDetail{get;set;}
  /*public string Name{get;set;}
    public string Phone{get;set;}
    public string email{get;set;}*/
    List<Contact> contactId;
     public ModifyContactData(ApexPages.StandardController std)
         this.cont = (Contact)std.getrecord();
         cont = new Contact();
         //contactId = ApexPages.currentPage().getParameters().get('id');
     public Contact go()
       contDetail = [select Name, Phone,email from Contact where id =:cont.SuperContact__c];
       system.debug('Queried Values' +contDetail);
       return null;  

I am getting Could not resolve the entity from <apex:inputField> value binding '{!}'. <apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.  Error

please let me know, what is going wrong.

Can anyone please let me know, how to go for this.