What worked for me was utilizing row.values(), because I was doing this within the models file! I haven't been able to find any documentation in regards to using it but that is what I was looking for! Thank you!
On Tuesday, March 15, 2016 at 2:15:12 PM UTC-7, Val K wrote: > > Hi! > Just for clarity: > *row.field_name* - access to field value of *record retrieved from DB *( > by db().select() ) > *form.vars.field_name *- access to field value of *submitted form *( > *after* form.process() ) > > form.vars - just a Storage() object like a dict() > > form.vars.keys() - list of all field_names > form.vars.values() - list of all field_values > > > > > > > > On Tuesday, March 15, 2016 at 11:22:45 PM UTC+3, [email protected] 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

