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
S DS D 

Trying to Update the InlineEditSupport Field in Controller?

I am trying to update the inlineEdited field in Extension Controller, and am not able to capture the value of the Phone# field in the Controller?


<apex:outputField value="{!candidate.Phone__c}" label="Phone#">
           <apex:inlineEditSupport event="ondblclick" showOnEdit="EditBttn" HideOnEdit="DelBttn" /> </apex:outputField>
My COntroller Code:
public string Phone{get;set;}  //how to capture the value ??

  public UpdateCandidateInfo(ApexPages.StandardController controller) 
  {
           this.jb = (Job_Application__c )controller.getRecord(); 
           system.debug( 'jb' + this.jb);
           system.debug('candidate Id' +  jb.Candidate__c);
  }
public void save()  // Also on click of Save this part of code is not getting called.
   {
         system.debug('Phone' +pPhone);  //in Logs i can see the Phone is empty
        candidate   = new Candidate__c ();
        candidate.Phone__c = pPhone;
        candidate.id= jb.Candidate__c;
       update candidate ;
      
   }


S DS D
Sorry for the typo, I want to save the value of inlineEdited Field to database. 

Requirement is : Any Phone which user would update on the LookupObject,  we need to capture that value in the controller and then save it by using a DML on candidate.
AshwaniAshwani
This have assigned value to "{!candidate.Phone__c}" which means value will be stored in "Phone__c" field of Candidate__c object which as instance name candidate.

There is no binding between "Phone" variable in controller with visualforce page.

Apply system debug to Phone__c

system.debug('Phone' +candidate.Phone__c); // value is here


James LoghryJames Loghry

To add on to Reid's response:

Instanciate your Candidate__c record in your constructor.  You're already referencing / updating the Phone__c field via your inlineEditSupport tag, so in your save method, you'll simply update the candidate record.  See the example below.

 

public class UpdateCandidateInfo{

    public Job_Application__c jb {get; private set;}
    public Candidate__c candidate {get; set;}

    public UpdateCandidateInfo(ApexPages.StandardController controller){
        this.jb = (Job_Application__c )controller.getRecord();
        this.candidate = new Candidate__c(Id = jb.Candidate__c);
    }

    public void save(){
        //This would already be taken care of in visualforce.
        //candidate.Phone__c = pPhone;
        update candidate;
    }
}

S DS D
Thanks guys, it helped.And i thought it has to be through some varibale :D.