0

I have a search Page ..When I do some search i will get some search results.In those results for one column needs to have a drop down (LOVs) and when i select a value from that drop down need to get saved. How to achieve this?

 <apex:outputLabel value="Deal Status" /> 
  <apex:selectList value="{!Dealsstatus}" multiselect="true" size="3" id="dealstat"> 
    <apex:selectOptions value="{!Dealstatus}"/>
 </apex:selectList>

<apex:outputtext value="{!a.Deal_Status__c}"/> </apex:column> 

/******/
Public List<selectoption> getDealstatus(){
        List<selectoption> options = new List<selectoption>();
        Schema.DescribeFieldResult fr = Tranche_Senior_Rollup__c.Deal_Status__c.getDescribe();
        List<Schema.PicklistEntry> plelist = fr.getpicklistvalues();
       //options.add(new selectoption('None','None'));
        for(Schema.Picklistentry ple: plelist){
            options.add(new selectoption(ple.getvalue(),ple.getlabel()));
        }
        return options;
    } 
if(Dealsstatus.length()>0){ 
    temp=Dealsstatus;
    DealsstatusList =Dealsstatus.split('\\,');
    Dealsstatus=Dealsstatus=Dealsstatus.replace(',','\',\'');
    Dealsstatus='\''+Dealsstatus+'\'';
    }
 if(Dealsstatus.length()>0) q=q+' and Deal_Status__c in: DealsstatusList';
4
  • I like your code =)
    – daniel-h
    Feb 17, 2014 at 15:51
  • Thank You..How to achieve the result records value with drop down and when we select those values needs to get saved into record.I am not getting this functionality.:(
    – user5257
    Feb 17, 2014 at 15:53
  • So, does it need to be saved immediately after selecting picklist value or do you have a save button on your page?
    – cartman
    Feb 17, 2014 at 19:32
  • Yes Please..I have save button as well.Please guide me how to achieve this.
    – user5257
    Feb 18, 2014 at 4:03

2 Answers 2

1

Use an <apex:actionSupport> to fire with the onchange event of your <apex:selectList>. You can have that fire a method in your controller to have it insert a record for you.

0

Create a custom text field in the backend and assign the selected value to it.

Something like custom_text__c = selectedvalue

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .