I am trying to display a lookup field based on the value of a picklist.

If the value 'Other' is chosen on the picklist, the showOtherAddress is set to true and then the rerender triggered by the Address picklist should display the field.

I cannot see anything wrong with the code but the field is not showing. This is the respective portion of the visual force page:

<apex:outputPanel id="addressList">
                        <apex:outputText styleClass="availableText" rendered="{!addressOptions.size != null}" value="({!addressOptions.size - 1} available)"/>
                        <apex:actionRegion >
                            <apex:selectList styleClass="form-control" value="{!order.DeliveryAddress__c}" size="1">
                                <apex:selectOptions value="{!addressOptions}"></apex:selectOptions>
                                  <apex:actionSupport event="onclick" action="{!updateAddressDetails}" rerender="selectedAddressDescription,otherAddress">
                    <label for="selectedAddressDescription">Address Description</label>
                    <apex:outputPanel id="selectedAddressDescription" styleClass="form-control">
                        <span >{!selectedAddressDescription}</span>
                    <apex:outputPanel id="otherAddress" rendered="{!showOtherAddress == true}">
                    <label for="other">Other Address</label><apex:inputField id="other" value="{!order.DeliveryAddress__c}"/>

And here's the part where my Apex class is being used:

public PageReference updateAddressDetails(){
    return null;

public void setAddressDetails(){
    if (order.Account__c != null){
        Account acc = [SELECT Address__c, Address_Description__c, Secondary_Address__c, Secondary_Address_Description__c FROM Account WHERE Id= :order.Account__c];
        if (order.DeliveryAddress__c == acc.Address__c){
            System.debug('Primary add');
            this.selectedAddressDescription = acc.Address_Description__c;
            this.showOtherAddress = true;
            //return this.selectedAddressDescription;
        } else if (order.DeliveryAddress__c == acc.Secondary_Address__c){
            System.debug('Secondary add');
            this.selectedAddressDescription = acc.Secondary_Address_Description__c;
            this.showOtherAddress = false;
            //return this.selectedAddressDescription;
        } else {// if (order.DeliveryAddress__c == 'Other'){
            this.showOtherAddress = true;
            this.selectedAddressDescription = '';
    } else {
  • You've commented out the line -- // if (order.DeliveryAddress__c == 'Other'){ Jul 27, 2019 at 4:41
  • It should still work though shouldn't it?
    – mesllo
    Jul 29, 2019 at 8:44


You must log in to answer this question.

Browse other questions tagged .