function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sanshasansha 

Problem while rerendering PageBlockSection

I have two objects:
 
1 EU_ProductRequest__c
2 OMS_Vendor__c
 
EU_ProductRequest__c has a lookup field against OMS_Vendor__c. When a user selects a particular value for the OMS_Vendor__c field, all the fields in the section BloombergUUIDsSection should be visible. Below is a part of the code.
 
               
               <apex:inputField value="{!EU_ProductRequest__c.OMS_Vendor__c}">
                     <apex:actionSupport event="onchange" rerender="BloombergUUIDsSection"/>
                </apex:inputField>
 
 
             <apex:outputPanel id="BloombergUUIDsSection">
              <apex:PageBlockSection title="Bloomberg UUIDs / First & Last Name (only required when OMS is Bloomberg)" rendered="{!EU_ProductRequest__c.OMS_Vendor__c='Bloomberg'}">
                <apex:inputField value="{!EU_ProductRequest__c.UUID1_First_Last_Name__c}"/>
            </apex:PageBlockSection>
            </apex:outputPanel>
 
However when I choose the value Bloomberg for the field EU_ProductRequest__c.OMS_Vendor__c, the section BloombergUUIDsSection does not rerender.
 
Please suggest.
 
Ron HessRon Hess
the onchange event is fired if you edit in the input field directly, but not if you change the value of the field using the popup dialog (looking glass)

not sure how you would catch the fact that another element has changed the content of that field.
sanshasansha
That appears to be one of the problems.
 
But even if I change the input field directly the rerendering works only if I specify the Id of the lookup field:
 
Instead of the below:
 
<apex:PageBlockSection title="Bloomberg UUIDs / First & Last Name (only required when OMS is Bloomberg)" rendered="{!EU_ProductRequest__c.OMS_Vendor__c='Bloomberg'}">
 
it works only if I specify the below:
 
<apex:PageBlockSection title="Bloomberg UUIDs / First & Last Name (only required when OMS is Bloomberg)" rendered="{!EU_ProductRequest__c.OMS_Vendor__c='a0cT00000009YjaIAE'}">
 
The Id will be different in sandbox and prod. So I need to specify the name.
 
Please suggest.
Ron HessRon Hess
try something like this

{!EU_ProductRequest__c.OMS_Vendor__r.name='Bloomberg'}


you will have to look up the relationship name instead of using the field OMS_Vendor__c which is the ID

sanshasansha
Looking up the relationship name works. However I guess as you mentioned earlier the onchange event does not get fired. So the dynamic rerendering does not happen.
 
Any other way out to get this done ?