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
asadim2asadim2 

I can't have inputText within repeat?!!!!

Controller:
public class TestRerenderController
{
    public List<String> text { get; set; }
    
    public TestRerenderController()
    {
        text = new List<String>();
        text.add('a');
        text.add('b');
        text.add('c');
    }
    
    public void hi()
    {
    }
}

VF page:
<apex:page controller="TestRerenderController" id="p">
    <apex:form >
        <apex:repeat value="{!text}" var="t">
            <apex:inputText value="{!t}"/><br/>
        </apex:repeat>
        <br/>
        <apex:commandLink action="{!hi}" value="Click me" reRender="p"/>
    </apex:form>
</apex:page>

Error when saving the page:
Error: Unknown property 't'


What gives?!
Best Answer chosen by asadim2
David "w00t!" LiuDavid "w00t!" Liu
This is the definition of apex:inputText according to the official documentation:
A merge field that references the controller class variable that is associated with this field.

I'm just guessing but maybe because since "t" is not a variable (it's one item of a collection that's a variable) it's not working. Whereas when you use the wrapper it's a variable on the object.

All Answers

Sonam_SFDCSonam_SFDC
As per the definition: apex:repeat : An iteration component that allows you to output the contents of a collection according to a structure that you specify.

asadim2asadim2
Thanks Sonam. I'm not sure; if I use a string variable within a wrapper class the inputText suddenly (and magically) works. See this thread:
https://developer.salesforce.com/forums/#!/feedtype=SINGLE_QUESTION_DETAIL&dc=Visualforce_Development&criteria=OPENQUESTIONS&id=906F0000000AgkIIAS (https://developer.salesforce.com/forums/#!/feedtype=SINGLE_QUESTION_DETAIL&dc=Visualforce_Development&criteria=OPENQUESTIONS&id=906F0000000AgkIIAS)

Today doesn't seem to be a good day..
David "w00t!" LiuDavid "w00t!" Liu
This is the definition of apex:inputText according to the official documentation:
A merge field that references the controller class variable that is associated with this field.

I'm just guessing but maybe because since "t" is not a variable (it's one item of a collection that's a variable) it's not working. Whereas when you use the wrapper it's a variable on the object.
This was selected as the best answer
asadim2asadim2
Interesting. That might be it then. Thanks.

Gaurav NirwalGaurav Nirwal
Please use this link 

(https://developer.salesforce.com/forums/#!/feedtype=SINGLE_QUESTION_DETAIL&dc=Visualforce_Development&criteria=OPENQUESTIONS&id=906F0000000AgkIIAS)
To solve this type of problem