+ Start a Discussion
Olivia FordeOlivia Forde 

Rendering options based on checkbox

I have this code
</apex:outputPanel>    
               <apex:outputPanel id="BU_Codes" >
                    <apex:repeat value="{!BUs}" var="BU">
                     <apex:pageBlockSection title="{!BU + ' Bar Codes'}" collapsible="false" rendered="{!BusUnits[BU]}">
                          <apex:inputField value="{!editItem.OTR_UPC_Code__c}"/>
                          <apex:inputField value="{!editItem.EA_UPC_Code__c}"/>
                          bucodes
                    </apex:pageBlockSection>            
                    </apex:repeat>
                </apex:outputPanel>
                
                <apex:outputPanel id="BU_Codes2" >
                    <apex:repeat value="{!BUs}" var="BU">
                       <apex:pageBlockSection title="{!BU + ' Bar Codes'}" collapsible="false" rendered="{!BusUnits[BU]}">
                          <apex:inputField value="{!editItem.OTR_EAN_Code__c}"/>
                          <apex:inputField value="{!editItem.EA_EAN_Code__c}"/>
                          bucodes2
                       </apex:pageBlockSection>       
                    </apex:repeat>
                </apex:outputPanel> 

which I believed would show the relevant fields depening on which check box was selected by using this

<apex:panelGroup >
                        <apex:inputCheckbox label="CA" value="{!BusUnits['CA']}" >
                            <apex:actionSupport event="onchange" rerender="BU_Codes2,BU_Effective_Dates"/>
                        </apex:inputCheckbox>
                        <apex:outputLabel value="CA"/>
                    </apex:panelGroup>
                    
                   <apex:panelGroup >
                        <apex:inputCheckbox label="US" value="{!BusUnits['US']}">
                            <apex:actionSupport event="onchange" rerender="BU_Codes,BU_Effective_Dates"/>
                        </apex:inputCheckbox>
                        <apex:outputLabel value="US"/>
                    </apex:panelGroup>

but both are shown and if I enter different data for two BU's only one is saved and is shown for both
Any ideas what I have done wrong ?
Olivia FordeOlivia Forde
Ignore this bit
if I enter different data for two BU's only one is saved and is shown for both