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
Sanjay92062Sanjay92062 

<apex:selectList with multiselect="true" is giving [] brackets, how to remove those brackets?.

Hi,
I am using the below code for multi-select.
<apex:selectList value="{!tab.tables__c}" title="Select" multiselect="true" size="5" id="selectListValue">
                              <apex:selectOptions value="{!tables}"/>
                          </apex:selectList>

and controller method is below,
public List<selectOption> getselectValues1(){
        List<Column___c> relatedprod = new List<Column___c>();
        relatedprod = [Select Id,name from Column___c where Table_Name__r.id =:tableValue ];
        List<SelectOption> columns = new List<SelectOption>();
        columns.add(new SelectOption('','-None-'));
        for(Column___c prod:relatedprod){
            columns.add(new SelectOption(prod.Name,prod.Name));
            
        }
        return columns;
    }

From the visualforce page,i can select multiple columns, but the issue is those columns are coming like [column1,column2]
How can I remove those brackets from the visualforce code?

Thanks in Advance !!
 
AnudeepAnudeep (Salesforce Developers) 
Can you please post your VF page code here? The change has be made at the page level
Sanjay92062Sanjay92062
Hi Anudeep,

please find the code.
 
<apex:page standardController="configs__c" extensions="Controller" id="pageId" lightningStylesheets="true">
        <style>
        #ct{
        text-align:center;
        font-size: xx-meadium;
        }
    </style>
    

    <apex:form id="formid">
        <div id="ct">
            <h1>New config</h1>
        </div>
        <apex:pageMessages ></apex:pageMessages>
        <apex:pageBlock id="pgblid">
            <apex:pageBlockButtons location="bottom" >
                <apex:commandButton action="{!Save}" value="Save"/>
                <apex:commandButton action="{!Cancel}" value="Cancel"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Details" collapsible="true" id="requestId">
                <apex:inputField value="{!sf.Name__c}"/>
                
                
                
               
                
                
            </apex:pageBlockSection>
            

            
      
            
            
            <apex:pageBlockSection title=" Details" collapsible="true" id="loadid">
                
         
                
                 <apex:PageBlockSectionItem >
                     <apex:outputLabel value=" Type"/>
                     <apex:actionRegion >
                          <apex:inputField value="{!sf.Type__c}">
                            <apex:actionSupport event="onchange" reRender="ajaxrequest" />
                        </apex:inputField>
                    </apex:actionRegion>
                  </apex:PageBlockSectionItem>
               
            </apex:pageBlockSection>
           
            <apex:outputPanel id="ajaxrequest">  
                  <apex:pageBlockSection rendered="{!sf.Type__c=='Others'}" >
                      
                    <apex:inputField id="schema" value="{!sf.Schema__c}">
                          <apex:actionSupport event="onchange" reRender="selectListValues" action="{!AccPopulated}"/>
                      </apex:inputfield>  
                                                <apex:selectList value="{!sf.Fields__c}" title="Select" multiselect="true" size="5" id="selectListValue">
                              <apex:selectOptions value="{!selectValues1}"/>
                          </apex:selectList>  
                      <apex:selectList value="{!sf.Table__c}" title="Select" multiselect="false" size="1" id="selectListValues">
    <apex:selectOptions value="{!selectValues}"/>
                          <apex:actionSupport event="onchange" reRender="selectListValue" action="{!AccPopulated1}"/>
</apex:selectList>    
                      <apex:inputField value="{!sf.DFilters__c}"/>
                    
                      </apex:pageBlockSection>
                <apex:pageBlockSection rendered="{!sf.Load__c=='ginf'}">
                     <apex:actionSupport event="onchange" reRender="selectListValues" action="{!AccPopulated2}"/>
                    <apex:selectList value="{!sf.DA__c}" title="Select" multiselect="false" size="1" id="selectListValues">
    <apex:selectOptions value="{!selectValues2}"/>
                          
</apex:selectList>  
                    <apex:inputField value="{!sf.A__c}"/>
                    <apex:inputField value="{!sf.DA__c}">
                         <apex:actionSupport event="onchange" action="{!getDataAssetFields}" rerender="Info"/>
                    </apex:inputField>          
                </apex:pageBlockSection>
                </apex:outputPanel>
       </apex:pageBlock>
    </apex:form>

    
</apex:page>

Thanks !!!