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
JO_DevJO_Dev 

How to get selected values from a picklist?

I am trying to get the picklist values from a multi select picklist but for some reason it is not coming through when exporting:

VF Page section

    <apex:form >
        <apex:pageBlock title="Article Export" mode="edit">
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton action="{!Export}" value="Email"/>
            </apex:pageBlockButtons>

            <apex:PageBlockSection title="" columns="2" collapsible="false">
            
            <apex:PageBlockSectionItem >
                    <span>Article Status: </span>
                    <apex:selectList value="{!selectedArticleStatusOptions}" size="7" multiselect="true">
                    <apex:selectOptions value="{! articleStatusOptions}" />    
                    </apex:selectList>
            </apex:PageBlockSectionItem>
            
            </apex:PageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>


Apex:

public with sharing class ArticleExport
{
        public Set<String> selectedArticleStatusOptions = new Set<String>();
    public ArticleExport()
    {
        this.articleStatusOptions = new SelectOption[]{‘Published’,’Draft’};
    }
 
    public SelectOption[] articleStatusOptions
    {
          public get;
          private set;
    }
    public PageReference Export()
    {
       selectedArticleStatusOptions
    }
}

 
Best Answer chosen by JO_Dev
JO_DevJO_Dev
I figured it out. Thanks

All Answers

JethaJetha
Your Export method in controller doesn't look clear to me.


Can you please rewrite code for your Export method.....
JO_DevJO_Dev
I figured it out. Thanks
This was selected as the best answer