+ Start a Discussion
SFDC DeepSFDC Deep 

Picking the current entered value in the outputfield (inlineeditsupport)

I need to pick up the current value of the outputfield that is entered by the user 
I have tried using the component Id in JS but had no luck 
further have used other methods in the following part of the code
<apex:pageBlockTable value="{!Records}" var="record" id="thePageBlockTable" styleclass="slds-table slds-table_cell-buffer slds-table_bordered" > 
                <apex:column >
                    <span style="float:right">
                        <span style="float:right;">
                            <apex:commandLink value="Save"  onclick="editTermExtract()" id="saveButton" styleClass="slds-button slds-button_neutral">
                            <apex:param value="{!record.id}" name="standrdId"/>
                            <apex:param value="{!record.Body__c}" name="currentbody"/>
                            <apex:param value="{!record.Type__c}" name="recordType"/>
                            </apex:commandLink>
                        <apex:commandButton value="Cancel" action="{!cancel}"  id="cancelButton" style="display:none;" styleClass="slds-button slds-button_neutral"/> 
                    </span>
                        <apex:commandLink rendered="{!If(record.Standard_Term__c!=null,true,false)}" action="{!revert}" reRender="thePageBlockTable" styleClass="slds-button slds-button_neutral">Revert
                            <apex:param value="{!record.id}" name="revertId"/>
                        </apex:commandLink>
                   <!--      <apex:pageblock rendered="{!If(record.Standard_Term__c!=null,true,false)}">
                           <span class="slds-pill " style="background-color:#00396B;padding:0px 4px;">
                            <span class="slds-pill__label" style="color:#ffffff">Modified</span>
                            </span>
                        </apex:pageblock> -->
                    </span>
                    <div class="tdData">
                          <apex:outputField value="{!record.Body__c}" id="Quoteterm"  styleclass="slds-truncate"> 
                        <apex:inlineEditSupport id="inltd" event="onclick" 
                                            showOnEdit="saveButton,cancelButton" />
                    </apex:outputField>
                    </div>
                                           
                </apex:column>
            </apex:pageBlockTable> 
           

            
        </apex:pageBlock> 
        </html>
             <apex:actionFunction action="{!save}" name="saveMeth" reRender="thePageBlockTable">
               
                <apex:param value="" name="changedTerm"></apex:param>
            </apex:actionFunction>
        <script type="text/javascript">
         $(document).ready(function() {
              $('[id$=inltd]').change(function(e) {
                 alert(e.target.value);
            });
          });
        function editTermExtract(){
                     
            //alert(p);
            //alert($('[id$=Quoteterm]').val());
            //alert($('[id$=Quoteterm]').text()+' jq+text');
            //alert($('[id$=Quoteterm]').html()+' jq+html');
            //var jsV = document.getElementById('Quoteterm');
            //alert(document.getElementsByTagName('p')[0]);
            //alert(jsV);
            // saveMeth($('[id$=Quoteterm]').text());
        }
        </script>
    </apex:form>
    </div>
</apex:page>
 
public class QuoteTermEditorController {
    
    public string body{get;set;}
    public string recordId{get;set;}
    public Map<Id,Quote_term__c> revertMap {get;set;}
    public List<Quote_term__c> termList {get;set;}
    public String revertid {get;set;}
    public boolean showButton{get;set;}
    public boolean showButton1{get;set;}
    public string selectedTemplate{get;set;}
    public List<Quote_term__c> termExtract{get;set;}
    public List<Quote_term__c> PrevData{get;set;}
    ApexPages.StandardSetController acon;
    public QuoteTermEditorController(ApexPages.StandardSetController acon) {
        this.acon = acon;
        recordId = ApexPages.currentPage().getParameters().get('id');
        //system.debug(recordId);
        revertMap = new Map<Id,Quote_term__c>();
    }
    public List<Quote_term__c> getRecords(){
        if(recordId!=null){
        List<Quote_term__c> termExtract = [select id,name,print_order__c,type__c,Standard_Term__c,body__c,Quote_del__r.name,(select id,type__c,name,Standard_Term__c,body__c,Locked__c from Quote_Terms1__r where Quote_del__c=:recordId and Active__c=true) from Quote_term__c where Type__c='Standard' or Type__c='Custom' order by print_order__c asc];
        termList = new List<Quote_term__c>();
        for(Quote_term__c term:termExtract){
            if(term.Quote_terms1__r.size()>0 ){
                    termList.add(term.Quote_terms1__r);
                for(Quote_term__c q:term.Quote_terms1__r){
                   revertMap.put(q.id,term);                    
                }
            }
            else{
            termList.add(term);
            }
        }
        }
        PrevData = new List<Quote_term__c>(termList);
        return termList;
    }
    public pagereference revert(){
                  revertid = ApexPages.currentPage().getParameters().get('revertId');
          system.debug(revertid);
          update new Quote_term__c(id=revertid,Active__c=false);
        for(Quote_term__c q:termList){
            if(q.id==revertid){
                termList[termList.indexOf(q)] = revertMap.get(revertid);
            }
        }
          return null;
    }
    public pagereference save(){
     String standrdId = ApexPages.currentPage().getParameters().get('standrdId');
     String body = ApexPages.currentPage().getParameters().get('currentbody');
     String type = ApexPages.currentPage().getParameters().get('recordType');
        update termList;
        for(Quote_term__c quoTerm:termList){
           // update quoTerm;
            system.debug(quoTerm + 'out');
            if(!PrevData.contains(quoTerm)){
               system.debug(quoTerm);
            }
        }
        
        if(type=='Custom'){
            Quote_term__c Custom = new Quote_term__c(id=standrdId,body__c=body);
            //system.debug(Custom);
            //update Custom;
           //system.debug(termList);
          // update termList;
        }
        system.debug(type);
        system.debug(standrdId);
        system.debug(body);
     return null;
    }
    
    public pagereference cancel(){
       
       return null;
    }
    public List<SelectOption> getTemplateOptions() {
        List<SelectOption> countryOptions = new List<SelectOption>();
        countryOptions.add(new SelectOption('','-None-'));
        for(Quote_Template__c QtTem : [Select id,name from Quote_Template__c]){
            countryOptions.add(new SelectOption(QtTem.name,QtTem.name));
        }
        return countryOptions;
    }
}

Thanks
Abhishek BansalAbhishek Bansal
Hi ,

You can pass the values to the js method like this:
onclick="editTermExtract('{!record.id}', '{!record.Body__c}', '{!record.Type__c}')"

In JS use the following syntax:
function editTermExtract(idValue, bodyValue, typeValue){
alert(idValue);
alert(bodyValue);
alert(typeValue);
}

Let me know if you need any other help.

Thanks,
Abhishek Bansal.
SFDC DeepSFDC Deep
Hi Abhishek,

The above way will send the value that we get from the controller, I have tried this earlier.

Thanks