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
h8r41dh8r41d 

Why can't I do this?

Visualforce page reduction:

<apex:inputText value="{!mytest[0]}"/>

 

Apex class :

Public class test {
     public List mytest {get; set; }

     public test() {
          mytest = new List<String> {'testing!!!', 'whatever!!!'};
    }
}

I get an unspecified error when I use arrays in my inputs.

Naidu PothiniNaidu Pothini
 <apex:inputText value="{!mytest[0]}"/> 

 

public List<String> mytest {get; set; }

public test() 
{
     mytest = new List<String> {'testing!!!', 'whatever!!!'};
}

 This will work. 

 

List Declaration is wrong.

 

To declare a list, use the List  keyword followed by the primitive data, sObject, nested list, map, or set type within <> characters

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_collections_lists.htm

h8r41dh8r41d

Oops, I wrote this up off the cuff as an isolation of the issue instead of posting my entire class and VF page. The declaration is correct in my code. I fixed it to avoid confusion.

 

The issue is somehow related to calling a save method which copies the string list values into an sobject field. I'm doing it this way to get around the problem of not being able to expose a field in the contact table to the customer portal. I put a "return" at the top of my save method for testing, the error is being thrown in the standard controller somewhere.

 

When I take the list out of the inputText and replace it with a string variable, it works. But with a string list item, it does not.

aballardaballard

I think there is currently a bug with using lists in input components in this way.

h8r41dh8r41d

Bug... as in it just plain don't work, right? :)

aballardaballard

yes, i think you will need to do this in some other way for now (without using a subscripted lsit reference in your inputText attribute).