function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vishesh91vishesh91 

post all values in select list to a variable

I want to set a array variable in controller from the values of select list.

controller:

public String[] searchFields= new String[]{};

public String[] getSearchFields() { 
    return searchFields;
}

public void setSearchFields(String[] searchFields) {
    this.searchFields = searchFields;
}

 visualforce :

 

<apex:selectList value="{!searchFields}>
     <apex:selectoptions value="{!options}" />
</apex:selectList>

 

but this does not post all the values of selectList in controller's searchFields variable.

options list is populated by getOptions method in controller.and yes values in searchFields list is modified by javascript on client end.Please help


SRKSRK

why don't you just create a multi select picklist
i u need i can share complete code with u

vishesh91vishesh91

actually user will not select any value,but still all values in list must be posted back to controller

 

requirments are like this

 

 

the add and remove button triggers javascript to move values from one list to other.on save all values in right side list must be posted to a array variable in controller.

 

I hope question is more clear now.Any Ideas will be og great help

 

Thanks

SRKSRK

You are using Javascript to move the values from left to right
so why don't u just create a comma saparate string within javascript & pass it back to controler   using param or Hidden input fields