+ Start a Discussion
QD93QD93 

Javascript Related List button pass values to VF page which allows inline edit and update those records

Hi,

The task I am trying to accomplish is a related list button, where I can select related child records from a parent object and click JS button, that sends me to a VF page that provides those select records and a value (number field), where I can inline edit and enter values into the number fields, and once I save the records are updated. Can somebody help provide code sample? Thanks!
QD93QD93
VF

<apex:page standardController="Opportunity" recordSetVar ="Opportunity" extensions="AddorUpdateAmounts">
<apex:form >
   <apex:pageBlock id="accountId">
       <apex:pageMessages />
       <apex:pageBlockButtons >
           <apex:commandButton value="Save" action="{!save}"/>
       </apex:pageBlockButtons>
       <apex:pageBlockTable value="{!opportunity}" var="pr">
           <apex:column headerValue="Name">
           <apex:outputField value="{!pr.Name}" />
           </apex:column>
           <apex:column headerValue="{!pr.id}"> 
           </apex:column>          
           <apex:column headerValue="Amount">
               <apex:inputField value="{!pr.amount}"/>
           </apex:column>
       </apex:pageBlockTable>
   </apex:pageBlock>
</apex:form>
</apex:page>
 
public with sharing class AddorUpdateAmounts {

public List<Opportunity> range;

    public AddorUpdateAmounts(ApexPages.StandardSetController controller) {
controller.setPageSize(20);
}

public List<Opportunity> getrange() {
   range = [Select Name, Amount from Opportunity  WHERE Opportunity.AccountId =:ApexPages.CurrentPage().GetParameters().Get('id')];
   return range;
}

public pageReference save() {
   update range;
   PageReference pageRef = ApexPages.currentPage();
   return pageRef.setRedirect(true);
}

public PageReference cancel() {
   PageReference pageRef = ApexPages.currentPage();
   return pageRef.setRedirect(true);
}



    public AddorUpdateAmounts(ApexPages.StandardController controller) {

    }

}