You need to sign in to do that
Don't have an account?
Soumya sri Reddy
how to use the Selectoption removeall and remove selected functionality in salesforce
i can add the values with copy functionaliyt, but can any one help me in the remove all and remove selected functionality in salesforce with the below code .
v.f.page:
Apex class:
Can anyone ,help to handle the removeall frm seleced cities and remove only selectedcites functionality
thanks and regards
soumya sree
v.f.page:
<apex:page controller="test11cntrl"> <apex:form > <apex:selectList id="Avilblecities" multiselect="true" tabindex="1" value="{!copyselectedvallist}" > <apex:selectOptions value="{!NotselectedOptions}"/> </apex:selectList> <br/> <apex:commandButton value="copyselected" action="{!copyselected}" rerender="selrdnr"/> <br/> <apex:commandButton value="Removeslected" action="{!removeselected}" rerender="selrdnr"/><br/> <apex:commandButton value="Removeall" action="{!removeall}" rerender="selrdnr"/><br/> <apex:outputPanel id="selrdnr"> <apex:selectList id="Selectedcites" multiselect="true" tabindex="1" value="{!copyselectedvallist2}" > <apex:selectOptions value="{!selectedOptions}"/> </apex:selectList> </apex:outputPanel> </apex:form> </apex:page>
Apex class:
public class test11cntrl { public list<string> copyselectedvallist{get;set;} public list<selectoption>NotselectedOptions{get;set;} public list<string> copyselectedvallist2{get;set;} public set<selectoption>selectedOptions{get;set;} public test11cntrl(){ copyselectedvallist= new list<string>(); NotselectedOptions= new list<selectoption>(); copyselectedvallist2= new list<string>(); selectedOptions= new set<selectoption>(); citylist = new list<string>(); citydetails(); } public list<string> citylist{get;set;} public void citydetails(){ citylist.add('mumbai'); citylist.add('maharastra'); citylist.add('uttarpradesh'); for(string s:citylist){ NotselectedOptions.add(new SelectOption(s,s)); } } public void copyselected(){ for(string s: copyselectedvallist){ Selectedoptions.add(new SelectOption(s,s)); } } public void removeselected(){ //remove the selected cites } public void removeall(){ //remove all cities } }
Can anyone ,help to handle the removeall frm seleced cities and remove only selectedcites functionality
thanks and regards
soumya sree