ここでレンダリングされた引数に行き詰まっています.visualforceページからではなく、レコード自体から値を取得していると確信しています。値 (are_you_kp__c) をレコードから「いいえ」に変更すると、pageblocksection がレンダリングされますが、何らかの理由でレンダリングされません。理由を知っている人はいますか?
ここでコントローラーの作業が必要だと思いますが、ここからどこに行くべきかわかりません...
<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>
更新 - outputPanel でレンダリングされる要素を正しい ID でラップしました: inputField の変更の結果としてレンダリングされたブール値を切り替えるという問題がまだあります - コントローラーでこれを切り替えるにはどうすればよいですか? inputField 値 = No かどうかを評価し、それによってレンダリングを true に設定する必要があると思います-方法はわかりません...
<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>
もう一度試してみてください - 今回はうまくいきますが、理由はよくわかりません...それだけです。これは、action="{!updateAnswer}" を上記の actionSupport に追加する (または下に表示する方法に関係なく) 追加です。
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;
}
おそらく関連するコントローラーコード
public ProposalExtension(ApexPages.StandardController pCon) {
this.p = (Proposal__c)pCon.getRecord();
}