You need to sign in to do that
Don't have an account?
JO_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
}
}
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
}
}
All Answers
Can you please rewrite code for your Export method.....