+ Start a Discussion
Hope E.Hope E. 

how to auto populate input fields based on select list values in visual force page


I have a VF page. I need to populate a list of contacts in a picklist. by changing it the fields name, phone should be prefilled. there is also an option to create a new contact. 
Is there any easy way to achieve this?

thank you!
Narender Singh(Nads)Narender Singh(Nads)
Hi Hope,
The exact code for VF page and its controller class would be too long to write. But yes, it aint that to achieve.
The following code snippet will help you.
<apex:selectList size="1" value="{!SelectedContact}">
             <apex:actionSupport event="onchange" action="{!CallYourControllerFunctionHere}" reRender="Give IDs of the section which you want to rerender" />
             <apex:selectOptions value="{!Contactlist}"/>
Use this link to better understand the apex components(tags)

let me know if it helps.