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
MaxFrielMaxFriel 

Rerender and inputfields...

All,

I want to have a set of input fields based off of a fieldSet that I can use to edit a record that has been selected from a drop down.  Here is the code I have...

<apex:selectList value="{!addSel}" multiselect="false" size="1" id="addSelect">
            <apex:selectOptions value="{!addItems}"/>
            <apex:actionSupport event="onchange" 
                      rerender="addBlock"/>
</apex:selectList><p/>

<apex:pageBlock title="Address" id="addBlock" mode="edit">
	<h2>addSel-{!addSel}</h2>
	<apex:variable var="address" value="{!addMap[addSel]}" />
	<h2>Address Name: {!address.Name}</h2>
	<apex:pageBlockSection title="My Content Section" columns="2">
	<apex:repeat value="{!$ObjectType.Address_vod__c.FieldSets.Lilly_Customer_Manage}" var="f">
		   <apex:inputField value="{!addMap[addSel][f]}"/> 
	</apex:repeat>
	</apex:pageBlockSection>
</apex:pageBlock>

 

 

addMap is a Map of id's to Address_vod__c.  The field Name is a part of the Lilly_Customer_Manage fieldset.  When I change the drop down, the variable addSel changes to the correct sfdc Id.  However the name field does not change as well as all the information in the inputFields.  The weird thing is, when I comment out the inputFields the heading in h2 with Name in it, changes as expected.  When I remove the field Name from the fieldSet the information in h2 also changes as expected.  So what am I missing with rerendering fields?  Am I going about this all wrong?

MaxFrielMaxFriel

To take fieldSets out of it

<apex:selectList value="{!addSel}" multiselect="false" size="1" id="addSelect">
            <apex:selectOptions value="{!addItems}"/>
            <apex:actionSupport event="onchange" 
                      rerender="addBlock"/>
</apex:selectList><p/>

<apex:pageBlock title="Address" id="addBlock" mode="edit">
	<h2>addSel-{!addSel}</h2>
	<apex:variable var="address" value="{!addMap[addSel]}" />
	<h2>Address Name: {!address.Name}</h2>
	<apex:pageBlockSection title="My Content Section" columns="2">
	<apex:inputField value="{!addMap[addSel].Name}"/>
	</apex:pageBlockSection>
</apex:pageBlock>

 If I remove the input field, h2 changes.  If I leave the inputField in it doesn't.  What is going on here?