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
jdogsailingjdogsailing 

Component-set Fields Not Updating

This is related to http://community.salesforce.com/sforce/board/message?board.id=Visualforce&thread.id=10946. The SurveyBean contains a list of SurveyFragments and they each contain a ResponseBean object. When my VF page elaborates the SurveyBean it invokes a custom component which renders the survey as a list of input widgets:

 

public class SurveyBean { ...

    public List<SurveyFragment> fragments {get; set;}
    public Boolean noContact {get; set; }
}

 

public class SurveyFragment { ...

    public ResponseBean response {get; set;}

}

     <apex:form >
        ...
        <apex:variable var="bean" value="{!ResponseDetail}">
            <apex:datalist var="fragment" value="{!bean.fragments}" type="1">
                <c:ResponseWidget fragment="{!fragment}" />
            </apex:datalist>
           <apex:inputCheckbox value="{!bean.noContact}" />

           <apex:commandButton value="Update" action="{!updateSurvey}" />
        </apex:variable>
    </apex:form>

<apex:component >
    <apex:attribute name="fragment" description="This is the fragment for the component"
        type="SurveyFragment" required="true"/> 
    <apex:outputText >{!fragment.response.question}</apex:outputText><br />
    <em>{!fragment.sInstructions}</em><br />
    <apex:inputText value="{!fragment.response.score}" title="Score"/><br /> 
    <em>{!fragment.cInstructions}</em><br />
    <apex:inputTextarea value="{!fragment.response.comment}" cols="80" title="Comment"/><br /> 
</apex:component>

 

public class SurveyBean { ...

    public List<SurveyFragment> fragments {get; set;}
    public Boolean noContact {get; set; }
}

 

public class SurveyFragment { ...

    public ResponseBean response {get; set;}

}

 

This works great for displaying the survey, but not when I press Update. Now, when the modified SurveyBean gets back to my controller, none of the values which were set into its ResponseBeans are available. They all have their original values. I know the SurveyBean is getting updated correctly, because it has a noContact checkbox widget and its state is being transmitted to the controller. My expectation is that the values set in the component should be copied back to the controller but this is evidently not the case. Where are the other values going? What do I need to do to make this do the right thing?

 

Jeff