I have a Visualforce page that collects user input for 125 integer variables that are then used by the controller to create records. I'd rather use an array instead of defining all those variables, but I can't seem to set a variable using

<apex:inputText value="{!inputValue[0][0]}" id="firstInputText"/>

I looked into apex:selectoptions but that doesn't look like I can use it since I need integer values from 0 to 20,000 rather than picklist-like values.

Any suggestions?

1 Answer 1


I'm not sure how you want it to display, but how about using an <apex:repeat> with a map?

Your class could look like this.

public Map<String,Integer> vals {
    get {
        if (vals == null) {
            vals = new Map<String, Integer> {
                'Value 1' => 0, 
                'Value 2' => 0, 
                'Value 3' => 0};
        return vals;

Then the page would be

<apex:repeat value="{!vals}" var="valKey">
        <apex:outputText value="{!valKey}" /> -- 
        <apex:inputText value="{!vals[valKey]}" /><br/>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .