1

I have a Code in VF where once i select the Account it gives Account details as 2 fields. The fields appear only after i select the Account. I want to show the blank fields by default and populate the values when the Account is selected. What do i change in the code?

</apex:pageblocksection>                
 <apex:pageblocksection id="accountSection" title="Account Information" showheader="true" columns="2" rendered="{!futureProd }">
 <apex:inputfield value="{!opObj.Account__c}" required="false">
 <apex:actionSupport event="onchange" action="{!AccountPopulated1}" rerender="accountSection" /> 
</apex:inputfield>                       

<apex:outputfield value="{!faObj.Open_Date__c}" rendered="{!acctDetail}"/>
<apex:outputfield value="{!faObj.Account_Name__c}" rendered="{!acctDetail}"/>
  • In your controller, simply have an empty Account object associated to variable faObj and remove the rendered= on each output field; when account is chosen from the inputField, populate faObj in the controller AccountPopulated action method – cropredy Mar 23 '16 at 0:18

Your Answer

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

Browse other questions tagged or ask your own question.