質問

ここでは私のレンダリングされた引数に立ち往生しています - 私はかなり正に正の私はレコード自体からの値を引いて、Visualforceページからではありません。レコードから「いいえ」に値(are_you_kp___c)を変更すると、PageBlockSectionsection Shoudはレンダリングされますが、何らかの理由ではありません。誰かが理由を知っていますか?

ここではいくつかのコントローラが必要なと思います - しかし、ここからどこへ行くべきかわからない...

<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>
.

更新 - 正しいIDを持つoutputPanelでレンダリングされた要素をレンダリングされるように折り返します。 InputFieldの値がNo= Noの場合に評価する必要があると思います。

<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>
.

大丈夫もう1つの試み - 今回はうまくいきますが、私はその理由がかなり得ません。これは、ActionSupportにActionSupportに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();
}
.

役に立ちましたか?

解決

<apex:outputPanel>に要素を折り返し、表示したい要素ではなく再レンダリングします。この問題は、要素がレンダリングされていない場合にページ内にはないため、再レンダリングの作業対象ではありません。

多くの人を捕まえることで、私自身が含まれています。one-solution.html "rel=" noreferrer "> http://www.laceysnr.com/2011/10/using-rerender-to-render-on-solution.html

**編集**

<apex:actionSupport>タグにアクションが指定されていないことを見つけませんでした。それを使用してコントローラ上のアクションを呼び出すことができます。選択リストはあなたが望む値に書き込まれているので、あなたは実際にはコード内の何もする必要はありません(あなたがしたいのでなければ)あなたはこれを行うことができます:

// controller
public Pagereference UpdateAnswer()
{
  // do some stuff if you want
  return null
}

// page
<apex:actionSupport action="{!UpdateAnswer}" status="StatusChange" event="onchange" rerender="PageErrors, appraiserInfo"/>
.

助けを願っています!

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top