+ Start a Discussion
Nick KahnNick Kahn 

Accessing inputField Values Created Inside apex:repeat

I need help in getting values from VF component page, just for the sake of clarity I have added very few fields to make my point across.
How to access inputField values that are created inside an apex:repeat.
When I do system.debug('updateMe >>>' + detailList) I see there is old data but NOT the updated value.
Here is the code snippet
 
VF Component:

<apex:component>
  <apex:attribute name="record" description="my custom object" type="meter__c" required="true" />  

    <!-- more fields -->
         <apex:inputField value="{!record.meter_reading__c}"/>
         <apex:inputField value="{!record.desc__c}"/>
</apex:component>
 
VF Page:

<apex:page Controller="MeterReading" >
  <apex:form > 
   <apex:pageBlock>    
      <apex:pageBlockSection>
         <apex:repeat value="{!detailList}" var="detail"> 
            <c:meter_vf_comp record="{!detail}" />
         </apex:repeat>
      </apex:pageBlockSection>
  </apex:pageBlock>
   <apex:commandButton value="Save" action="{!updateMe}"/>
  </apex:form>
</apex:page>
 
Controller:

public with sharing class MeterReading 
{
  public List<meter__c> detailList { get; set; }

public MeterReading() 
{
   detailList = [/*SOQL*/];  //loading the data and display in repeat...
 }

public PageReference updateMe() {
    system.debug('updateMe >>>' + detailList);  
    return null;
}

}

 
James LoghryJames Loghry
It should all be passed by reference in such that you can iterate through detailList and grab the right information..
 
public PageReference updateMe(){
    for(Meter__c m : detailList){
        //This should show the same values the user entered in VF..
        System.debug(m.meter_reading__c);
        System.debug(m.desc__c);
    }
    update detailList;
}