You need to sign in to do that
Don't have an account?
Hopefully An Easy Question...
My question is, if I have input fields that are named with the same ID multiple times, what is the syntax to pass the inputted value into my APex class:
For example: I have the following that is in a loop for the number of financial accounts I returned in a query. So I may have ONE or MANY of these
my loop...
<tr>
<td align="right">From Date:(mm/dd/yyyy)</td>
<td><apex:inputText id="fromDate" value="{!fromDate}"/></td>
</tr>
<tr>
<td align="right">To Date:(mm/dd/yyyy)</td>
<td><apex:inputText id="toDate" value="{!toDate}"/></td>
</tr>
end loop...
In other languages when I have had this situation I would have a field named fromDate, which would be an array of values, and if I wanted the 5th one from my input form it would be fromDate[5]. How is this done in Apex/VisualForce ?
If I were to name them uniquely like fromDate1, toDate1, fromDate2, toDate2, then I would have to create getter/setter for every one in the loop! There has to be an easier way right?
Thanks guys and gals.
Ok, This is how your apex will be
All Answers
Use Wrapper class and create a list and bind in your loop
http://wiki.developerforce.com/page/Wrapper_Class
Thanks, I read the link but I am new to Apex and could use a little more help with the syntax .
Would there be a list for the fromDate and a list for the toDate?
Could you give me an example of what the wrapper class might look like for my example. I am a little confused about the List declaration in the Apex wrapper class.
Thanks so much for your help, I greatly appreciate it.
Ok, This is how your apex will be
Thank you so much for all your effort, I learned a lot from you today and I really appreciate it.