You need to sign in to do that
Don't have an account?
Kirill_Yunussov
ISSUE: Assigning data directly to array elements. Possible?
Hi,
There seems to be some problem in VisualForce/Apex where it just won't assign values to elements of arrays if you access the elements by subscript number. So weird. Maybe I am not using correct syntax? Please advise!!
//controller public String[] someStrings {get;set;} someStrings = new String[5]; //page <apex:inputText value="{!someStrings[0]}"> // when using the syntax of someStrings[0], it compiles, but breaks somewhere before even running a method. Is this a syntax issue or SF limitation??
Hi,
In VF pages does n't support displaying the array elements as you wrote.
Here you want to dispay only array first element then store that value in a variable (declare as a apex property), then access that variable in VF page.
public string str {set; get;}
str = someString[0];
<apex:inutField value ={!str}>
it works...
Others wise you wish to to display entire array use data table or page block table with apex:column tag.
regards,
Buss.
All Answers
Hi,
In VF pages does n't support displaying the array elements as you wrote.
Here you want to dispay only array first element then store that value in a variable (declare as a apex property), then access that variable in VF page.
public string str {set; get;}
str = someString[0];
<apex:inutField value ={!str}>
it works...
Others wise you wish to to display entire array use data table or page block table with apex:column tag.
regards,
Buss.
Thanks for clarification, Buss!