• Tanmoy Dash
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
Hi, 

I am trying to display the account details ( name, address, phone ) for the account selected in picklist. I have written the code for picklist as below. Any help is appreciated. 

<apex:page Controller="accountcontroller" showHeader="false">
    <apex:form>
        <apex:pageBlock title="Display Account Details: ">
            
            <apex:pageBlockSection>
            <apex:outputLabel value="Account Name: " />
            
            <apex:selectlist value="{!accid}" size="1" >
                <apex:selectOptions value="{!accountnames}" />
                <apex:actionSupport event="onchange" rerender = "display"/>
            </apex:selectlist>
            </apex:pageBlockSection>
            
        <apex:pageBlockSection title = 'Account Details'>
            
        </apex:pageBlockSection>    
            
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller 

public class accountcontroller {

    public string accid {get; set;}
    
    public list<selectoption> getaccountnames() {
        
        list<selectoption> accoptions = new list<selectoption>();
        for (account acc : [select id, name from account]){
            accoptions.add(new selectoption(acc.id, acc.name));
        }  
        return accoptions;
    } 
}

Thank you,
Satya

Hi, 

 

  I am new to SalesForce and Am newbie learning Visual Force and Apex Codding. I created a new custom object with name customer_details_c and desinged a page using visual force. 

 

 In customer_details_c object it has First_Name_c and Last_Name_c as two custom fields. 

 

 Now My requirement is to create a class or controller to insert the data into customer_details_c object. Please suggest me know. How to write the class or controler with an example. 

 

Thanks

Sudhir