to display the multiselect picklistvalues in a list of string
hai
I had created an Multiselect Picklist in sale__c.and i have created a pagelayout and place Sale__c page layout .
I have been stored the picklist value in string list..
I have picklistlist values are A,B,C
Those selected values i have taken in list
but those selected values must display like that
variables[0] A variables[1] B variables[1] C
they are displaying in debuglog but not displaying in visulforce page
Class
public class os1 { String id; public Sale__c a1 {get;set;}
public list<String> str{get;set;} public List<String> BrowseFile{get;set;} public os1(ApexPages.StandardController stdcontroller) {
this.id=ApexPages.currentPage().getParameters().get('id'); } public PageReference submit() { Sale__c a1=[select id,name,variable__c from Sale__c where id =:this.id];
Set<String> temp = new Set<String>(); for( Integer i = 0; i<result.size(); i++) { string str=result[i]; system.debug('xxxxxxxxxxxxxxgfgxyuuiff'+str); } }
} }
In that apex repeat no values are being passed in it but while checking in debuglog values are been passed but values are nt display in the visualforcepage
You should not initialise in an action method - initialise in the constructor.
It has been covered here :
http://boards.developerforce.com/t5/Visualforce-Development/Reason-why-action-attribute-of-apex-page-should-not-be-used-for/td-p/104343
and to some extent here :
http://bobbuzzard.blogspot.com/2011/08/dml-during-initialisation.html
when am intialsed in constructor also it did nt displayed can u help me to solve this problem ...and to display in visualforce page ...
Visualforcepage
<apex:page standardController="sale__c" extensions="os1" >
<apex:pageBlock >
<apex:form >
pickvalue
<apex:inputfield value="{!a1.Variable__c}"/>
<br/>
Selected variables
<apex:outputText value="{!BrowseFile}" />
<br/>
dfd
<apex:outputText value="{!str}" >
</apex:outputText>
<apex:repeat value="{!str}" var="temp" >
TEST{!temp}
</apex:repeat>
</apex:form>
</apex:pageBlock>
</apex:Page>
class:
public class os1 {
String id;
public Sale__c a1
{get;set;}
public list<String> str{get;set;}
public List<String> BrowseFile{get;set;}
public os1(ApexPages.StandardController stdcontroller)
{
this.id=ApexPages.currentPage().getParameters().get('id');
Sale__c a1=[select id,name,variable__c from Sale__c where id =:this.id];
BrowseFile = new List<String>();
BrowseFile.add(a1.variable__c);
string[] aaa=browseFile;
system.debug('xxxxxxxxxxxxxxx'+aaa);
for(String s: aaa)
{
Integer n = s.length();
String[] result=s.split(';',3);
Set<String> temp = new Set<String>();
for( Integer i = 0; i<result.size(); i++)
{
string str=result[i];
system.debug('xxxxxxxxxxxxxxgfgxyuuiff'+str);
}
}
}
}
In that apex repeat no values are being passed in it but while checking in debuglog values are been passed but values are nt display in the visualforcepage
it must display like this
variables[0]=A
variables[1]=B
variables[2]=C
thanks in advances
So your VF page does an apex repeat over a property in your coltroller called "str" to display the text values.
In your controller I see a list of String called "str" with the default get / set.
I do not see anywhere in your controller where you put any string values into this List<String> so how can the page display anything ?
k how to solve that problem
i want to display in these format
variables[0]='A';
variables[1]='B';
variables[2]='C';
in visualforcepage is please help me to solve that problem