1

I've been facing with this kind of issue:

I've a VFPage that has to work in a section embedded in a Standard Layout of a Standard Object (Quote).

My goal to reach is:

When a value is selcted from the first picklist a function is called from the controller to set a custom field of the current Quote and at the same time the second picklist should be rerendered to show informations based on the value selected for the first picklist.

Moreover, when I pick a value from the second picklist another function is called to set another field of the current Quote, and the page should be refreshed to show the new value in the new fields.

I'm getting in trouble with this, because it doesn't work properly, It works only the first time, but when I change again the picked values nothing works at all.

 <apex:page standardController="Quote" extensions="Quote_ManageRelatedListController">
    <apex:form >          
        <apex:pageBlock title="Select Price Book" >
            <apex:pageBlockSection >
                <apex:pageBlockSectionItem >
                    <apex:outputLabel >Eligible Price Book</apex:outputLabel>
                    <apex:selectList id="PriceBook" size="1" value="{!selectedPriceBook}">
                        <apex:selectOptions value="{!pricebook}"/>
                        <apex:actionSupport event="onchange" reRender="Offer" action="{!getOffer_reload}"/>
                    </apex:selectList>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            <apex:pageBlockSection >
                <apex:pageBlockSectionItem>
                    <apex:outputLabel >Eligible Offer</apex:outputLabel>
                    <apex:selectList size="1" value="{!selectedOffer}" id="Offer">
                        <apex:selectOptions value="{!offer}"/>
                        <apex:actionSupport action="{!setOffer_reload}" event="onchange" />
                    </apex:selectList>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Unfortunately, I can't show the controller, but I've selectedOffer and selectedPriceBook declared as public with get and set methods, pricebook and offer in the select options have got function getOffer and getPriceBook. The getOffer_reload does the first part of my goal (select a value, set pricebook field in current quote and rerender values of offer selectOption), the setOffer_reload does the second part (or at least it is supposed to do that) pick an offer value and set the offer field in the current quote.

Thanks in advance.

  • you may need to apply "rerender" attribute to the second action:support tag for the offers one. – Nitin Jan 20 '16 at 11:10
  • Nope, it doesn't work anyway....the problem is that when the second actionSupport executes the action associated it doesn't pick the value! – Fabio Maturo Jan 20 '16 at 11:16
  • I assume that this is due to lack of rep points. But you can always put comment instead of edit answer. Good to know it helped! :) – Ashwani Jan 20 '16 at 12:30
0

Re-setup rerender for pageblocksection as below:

         <apex:pageBlockSection  id="offer_top">
                <apex:pageBlockSectionItem >
                    <apex:outputLabel >Eligible Price Book</apex:outputLabel>
                    <apex:selectList id="PriceBook" size="1" value="{!selectedPriceBook}">
                        <apex:selectOptions value="{!pricebook}"/>
                        <apex:actionSupport event="onchange" reRender="Offer" action="{!getOffer_reload}"/>
                    </apex:selectList>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            <apex:pageBlockSection >
                <apex:pageBlockSectionItem id="Offer">
                    <apex:outputLabel >Eligible Offer</apex:outputLabel>
                    <apex:selectList size="1" value="{!selectedOffer}" >
                        <apex:selectOptions value="{!offer}"/>
                        <apex:actionSupport action="{!setOffer_reload}" event="onchange" rerender="offer_top"/>
                    </apex:selectList>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>

Fabio: Thanks, it solved my issue...! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.