I'm stuck on my rendered argument here - I'm fairly positive i'm pulling values from the record itself and not from the visualforce page. When I change the value (are_you_kp__c) from the record to a "No" - the pageblocksection shoud render, but for some reason it doesn't. Does anybody know why?
I think I need some controller work here - but not sure where to go from here...
<apex:pageBlock title="New Bid" mode="maindetail" tabStyle="Proposal__c">
<apex:messages/>
<apex:actionRegion>
<apex:pageBlockSection columns="2" title="Bid Information" collapsible="false" showHeader="true">
<apex:inputField value="{!rfp.Bid_Amount__c}"/>
<apex:outputField value="{!rfp.Bid_Date__c}"/>
<apex:inputField value="{!rfp.Bid_Deliver_By__c}"/>
<apex:inputField value="{!rfp.Bid_Comments__c}"/>
<apex:pageBlockSectionItem>
<apex:outputLabel value="Are you the Key Appraiser?"/>
<apex:outputPanel>
<apex:inputField value="{!rfp.are_you_kp__c}" required="true">
<apex:actionSupport status="StatusChange" event="onchange" rerender="PageErrors, appraiserInfo"/>
<apex:actionStatus startText="Updating page ..." id="StatusChange"/>
</apex:inputField>
</apex:outputPanel>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:actionRegion>
<apex:pageBlockSection title="Testing" columns="2" rendered="{!rfp.are_you_kp__c == 'No'}" id="appraiserInfo">
<apex:pageBlockSectionItem>
<apex:outputLabel value="Single Point of Contact" for="spoc"/>
<apex:selectList id="spoc" value="{!rfp.SPOCL__c}" size="1" title="Single Point of Contact Select">
<apex:selectOptions value="{!SPOCS}"></apex:selectOptions>
</apex:selectList>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
Updated - wrapped the to be rendered element in outputPanel with correct id: Still have the problem of toggling my rendered boolean as a result of a change on an inputField - how would I toggle this in the controller? I think i need to evaluate if the inputField value = No, and set the rendered to true by that - i'm not sure how though...
<apex:outputPanel id="appraiserInfo">
<apex:pageBlockSection title="Testing" columns="2" rendered="{!rfp.are_you_kp__c == 'No'}">
<apex:pageBlockSectionItem>
<apex:outputLabel value="Single Point of Contact" for="spoc"/>
<apex:selectList id="spoc" value="{!rfp.SPOCL__c}" size="1" title="Single Point of Contact Select">
<apex:selectOptions value="{!SPOCS}"></apex:selectOptions>
</apex:selectList>
</apex:pageBlockSectionItem>
</apex:pageBlockSection></apex:outputPanel>
Alright one more attempt - this time it works, but I don't quite get why...only that it does. This is in addition to adding action="{!updateAnswer}" to the actionSupport above (or below, whichever way you see it)
public pageReference updateAnswer(){
if(this.p.are_you_kp__c == 'No')
rfp.are_you_kp__c = 'No';
try{
update rfp;
}
catch (DmlException ex){
ApexPages.addMessages(ex);
return null;
}
return null;
}
Probably relevant controller code
public ProposalExtension(ApexPages.StandardController pCon) {
this.p = (Proposal__c)pCon.getRecord();
}