I have a field that is rendered like so:
<apex:pageBlockSectionItem >
<apex:outputLabel value="{!$ObjectType.Event.fields.Customer_Facing_Event__c.Label}" for="{!event.Customer_Facing_Event__c}" />
<apex:actionRegion immediate="true">
<apex:inputField value="{!event.Customer_Facing_Event__c}">
<apex:actionSupport event="onchange" reRender="pbs_customerToMeet"/>
</apex:inputField>
</apex:actionRegion>
</apex:pageBlockSectionItem>
This is a boolean field that defaults to true. I'd like to use the value of this field to toggle the visibility of a Page Block Section
, like so:
<apex:pageBlockSection title="CUSTOMER TO MEET" collapsible="false" id="pbs_customerToMeet"
rendered="{!event.Customer_Facing_Event__c}">
{!event.Customer_Facing_Event__c}
<apex:pageBlockSectionItem >
</apex:pageBlockSection>
The problem is that, although the field defaults to true
, it appears that the value of the field is in fact false
, and Salesforce instead just renders the input as checked
. This causes my PageBlockSection
to not be visible on the initial page render.
How can I make the section render initially?
immediate="true"
will cause no data from your form to be posted back to the controller, including the value of the checkboxevent.Customer_Facing_Event__c
. If you remove this attribute does the behavior change?event
?(Event)controller.getRecord();