+ Start a Discussion

vf page to datamodel

 hello group


                 i hav enquiry page displayed a  picklist field (select course(retrievd 'Name' from another s-obj (course)))  in vf page. so my requirement is when i click save in vf page it must enter in to enquiry object a field a called Preffered_Courses__c(text).


i hav used below code to display a picklist field ..............



<apex:outputLabel style="font-weight:Bold" value="Select a course :">
          <apex:SelectList size="1" value="{!course}">
          <apex:selectOptions value="{!items}"/>



 public String course {get; set;}
    public List<SelectOption> getItems(){
        List<SelectOption> options = new List<SelectOption>();
    List<Course__C> lst = [select Name from Course__c];
     options.add(new SelectOption('--Select Course--','--Select Course--'));
    if(lst != null){
        for(Integer i=0; i < lst.size(); i++){
            options.add(new SelectOption(lst[i].Name,lst[i].Name));
        return options;



  my requirement is when i save record in vf page select courses field in vf page must enter in to enquiry object(Preffered_Courses__c(text).)


 pls send me code for this . Iam new to salesforce


 pls guide me to r8 way to achive my requirement


 thanks for giving reply (in advance)............



Jeff MayJeff May

You will need to write a customController or an controller extension to handle the 'Save' on your VF page.  The controller is just an Apex class that has public methods that can be called in the VF page.