I have a table defined with 3 input fields and then an upload field. The upload field is used to take the values that are entered by the user and input them into a file which contains all form field values from the session.
The form is generated dynamically, so the number of form fields varies with each session.
I am stuck on figuring out how to capture the individual form field values. I am unsure if maybe I should be reading these into an array and then populating the file?
If the form that is generated contains only one instance of the form fields, I can grab these values by doing row.field1, row.field2, row.field3.
I was wondering if web2py contains a method for dealing with the multiple instances of form fields?
For example, if the user created two instances of the form fields I would capture values like this:
row.field1_0, row.field2_0, row.field3_0
row.field1_1, row.field2_1, row.field2_1
However this does not work..
I have tried doing variations of the following:
for i in row.field1:
print row.field1
When I run this with a session containing the form with two instances of form fields it will show me the values that were inputted for that session in field1_0, as well as field1_1. So I am able to at least see that it is capturing the separate entries in the single form. I am just not sure how can I can iterate through the form fields or if there is a keyword or method within web2py which will allow me to do this so I can place them accordingly before the file is uploaded.