for i in range(0, number_of_total_fields):
    row[field+i]

Richard

On Tue, Mar 15, 2016 at 4:22 PM, <aetagot...@gmail.com> wrote:

> 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.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to